Carrierwave is my favorite gem for handling uploads and image thumbnail generation (attachment_fu died of old age and paperclip suffers from hashitis, not a pretty picture)
Anyway our imagebank was still on attachment_fu even though I upgraded to rails3 months ago. We couldn't add images and going through some dirty hacks to resuscitate attachment_fu was too much black magic.
So CarrierWave it was.
But how to stick to attachment_fu's naming convention. CarrierWave has a nice and clean way to migrate from paperclip but none from attachment_fu, because J. Nicklas claims, they're too far a part.
Well here's a little module you can include in your uploader and adapt to your needs.
Any Questions ?
4 comments:
Thanks! Just what I was looking for to help with my move to CarrierWave.
The only problem I found with this is that when version_name is nil, and filename contains underscores, this code will strip them out: my_pic.png will become mypic.png. The problem is that when version_name is nil, "#{version_name}_" becomes "_", and then it gsub's "_" out of the filename.
Prefacing it all with "return filename if version_name.blank?" fixes it.
Hi There,
Thank you for that post, however can you tell me how to use after included that into the uploader class?,
Thank you
Very useful, thanks!
Post a Comment