I have a model that has:
mount_uploader :image, ImageUploader
When uploading an Image I want to retrieve some width, height and some EXIF data from the image. In a before filter I am calling self.image.url
but this will return something like:
/uploads/tmp/20110630-1316-10507-7899/emerica_wildinthestreets.jpg
The problem is that when I try to open this image using:
image = MiniMagick::Image.open(self.image.url)
I get "No such file or directory - /uploads/tmp/20110630-1312-10507-6638/emerica_wildinthestreets.jpg". It seems like the image has already been moved from the tmp folder to it's final location but self.image.url
is not reflecting this change.
I've also tried this in an after_save
method but the result is the same. Any ideas?
Turns out I needed to append "#{Rails.root.to_s}/public/" to self.image.url
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With