Created
January 28, 2012 16:56
-
-
Save bil-bas/1695008 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| compile '/images/screenshots/*/', rep: :thumbnail do | |
| filter :thumbnailize, factor: 0.25 | |
| end | |
| route '/images/screenshots/*/', rep: :thumbnail do | |
| item.identifier.chop + '-thumbnail.' + item[:extension] | |
| end | |
| ------------------- | |
| # layouts/screenshot.html.haml | |
| - path = "/images/screenshots/#{@image}" | |
| - screenshot = @items.find {|i| i.identifier == "#{path}/" } | |
| # Fails here, unless the full-size screenshots exist in output, unless I use 'screenshot.compiled_content', which spits out a big error, of course. | |
| - thumbnail = screenshot.rep_named(:thumbnail) | |
| - image = ChunkyPNG::Image.from_file("output#{path}-thumbnail.png") | |
| - @title ||= @alt | |
| = link_to screenshot.path, rel: "lightbox-gallery" do | |
| %img{ class: "thumb", src: thumbnail.path, alt: @alt, title: @title, width: image.width, height: image.height } |
bil-bas
commented
Jan 28, 2012
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment