Just assign the existing attachment to another record:
new_photo = Photo.new new_photo.image = old_photo.image
Paperclip will duplicate the file when saving.
To use this in forms, pimp your attachment container like this:
class Photo < ActiveRecord::Base has_attached_file :image attr_accessor :copy_of def image_url if copy_of copy_of.url else image.url end end end
And in the controller do:
new_photo = Photo.new(:copy_of => old_photo)
~/.bashrc and reload afterwards:
Lemonade’s goal as a sprite generator is to be incredible easy to use, so you’ll use ist for every project—just because there’s no overhead. It needs no configuration, no Rake task, no Photoshop, just a little change in your Sass or SCSS files.
File upload solution that supports form roundtrips when a validation fails.
Pretty print your Ruby objects with style – in full color and with proper indentation
Speech bubble icons have become synonymous with comments. When creating yet another one for a standard comment link, it occurred to me that there might be a way to make the icon without ever opening up an image editor. It could all be done with CSS
We simply convert your design (PSD, PNG, AI, etc.) into a hand coded, pixel perfect and Standards compliant XHTML/CSS. Since our service is targeted to agencies and freelancers the job done by us is 100% confidential. In addition we are offering payment after satisfaction.
It’s a fact of CSS life that the ‘border’ of any block level element gets factored into it’s final box size for layout. That means that if you add a border on a hover to an element that didn’t already have a border of that exact size, you will cause a layout shift.
MailStyle allows you to write the css for your html emails as you normally would, then writes the styles inline when you send your emails. It also makes sure that your image paths are absolute rather than relative.
DevIL is a fast and lightweight image library that supports the loading and saving of images in almost any graphics format. It also provides some basic image manipulation functionality.
Just because you are capable of building a bikeshed does not mean you should stop others from building one just because you do not like the color they plan to paint it.