I supposed to write this weeks ago though, anyway. Here is vyw, it’s a client side file browser. Vyw actually is a continuation of this post. At least the idea was already popped up around that time, but I only had the chance to tinker around it few weeks ago.
So the idea was to have this fully functional file browser, or specifically, images browser with thumbnail view, which usually achieved with server-side app, backed only with nginx.
Currently working on the re-implementation of shreds client-side and move to es6 while I’m on it. Figured out I might as well write some note on its current implementation, annotating the caveats or something.
Anyway, the main concept was to be able to add new feature (to the app) quickly, while maintaining the whole (supposed to be modular) structure. The whole app is started with this main (singleton) object called shreds.
I’ve been putting up some courage to actually write about this thing. Started working on this roughly 1 and a half years ago, I believe it was not long after Google initially announced that they’ll closing Google Reader.
As I realized that I never build any barely-usable so-called-product, also for the fact that my related skills on this were sound more like a joke, I kept the repository private for some months. It was really hard when feedbin announced, since we both built based on the same stack (We both based on ruby on rails, and using feedzira (later feedjira) as our core feed fetcher). I think I was supposed to drop the project and use feedbin instead, considering it’s waaay more superior in addition of its massive community.
This one is late for about… 24 days?
I re-made the image viewer almost from scratch also renamed it to picto.
At the last post I showed the snippet on how imgpop html template looks like. And while I said it was neat, it is not. The new template actually looks like this: in a straight one line.
<ahref="<%= image %>"id="image-<%= id %>"rel="pict"w="<%= full_width %>"h="<%= full_height %>"><imgsrc="<%= scaled_image %>"alt="<%= title %>"class="<%= klass %>"/></a>
So let say I call the imgpop like this
From the tag above the rendered html will looks like this
<ahref="/a/20120327-stony_cat/Screenshot-2012-03-27_22.22.41.png"id="image-1"rel="pict"w="1920"h="1080"><imgsrc="/a/20120327-stony_cat/resized_Screenshot-2012-03-27_22.22.41.png"alt="Tagline for The Pict."class="center"/></a>
Far more simple, and better, no script tag pollution.
The backend magic were performed by MiniMagick (pun intended). As you may see above, I put the resized image rather than the original one inside the post. Just when the image clicked, the original image showed inside a popup, plus tagline at the bottom, and nice resize button feature hidden at the right-top corner. Try hover your mouse to the right top corner of the image and click the resize button. Of course nothing will happen if the image were not resized by MiniMagick, or smaller than your browser portview size.
Now I will going into technical details inside imgpop.
Like I said in the previous post. I extends Brian’s imgpopup and do some makeup to things.
At the backend, I use mini_magick to actually save the resized image, and use that as preview/thumbnail.
Here’s the snippet.
#...## Open the source image, and scale it accordingly.image =MiniMagick::Image.open(image_path)
vars['full_width']= image[:width]vars['full_height']= image[:height]image.resize "#{@percent}%"rpath = source+ resized_image
ifnotFile.exists? rpath
# Actually save the image image.format "jpg" image.quality "92" image.write rpath
# This is the tricky part# we should register the new created file# since Jekyll already indexed all files before context.registers[:site].static_files <<StaticFile.new(
context.registers[:site], source, File.dirname(@path.sub(%r{^/}, '')),
"resized_#{File.basename(@path)}")
print "image saved to #{rpath}\n"end#...#
Yay, it’s up. You can click images above to try it out. a pop-up will appear with full sized image, and it’s draggable! You can also try hover the upper area of the popup to see the tagline/title and download link for the image.
Credits to Brian Clapper. He made the base implementation for this with jQuery and jQueryUI. From there, I extend some stuff to make it more organic.
I apologize for the inconvenience to refreshing your browser cache. For I randomly changing the site’s layout. Now I made the whole page a bit smaller, including the fonts. Also fixed mobile view for navigation bar. Which is hacky.
So it appears that this theme support mobile view (duh). That navigation bar above will shrink and turn into drop down menu if browsed from mobile device. And it happened that I broke this feature when I moved the search box to the sidebar.
I stumbled upon this project last night.
todo - Todos in the CLI like what. And that’s cute.
So I decide to give it a spin and a bit inspired to extend its potential.
The first thing that bugged me is that todo store its data locally under its installation folder. It might not convenient since that means it can’t be used by multiple user, except each user install its own.