Skip to content

Instantly share code, notes, and snippets.

@nthj
Created June 6, 2011 04:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nthj/1009755 to your computer and use it in GitHub Desktop.
Save nthj/1009755 to your computer and use it in GitHub Desktop.
Create thumbnail of provided key, and save it as {key name}_medium.jpg
# if "key" equals "bird.jpg",
# then this code creates a smaller thumbnail of the bird,
# sized to 270 by 167 pixels,
# adding a watermark,
# compressing the thumbnail to save space,
# and saving the new thumbnail as "bird_medium.jpg"
Original.find(key).compress(70).resize(270, 167).to(:fit).watermark.save(:medium)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment