# Reprocess attachment\_fu thumbnails with ImageMagick edits

**URL:** <https://www.ruby-forum.com/t/reprocess-attachment-fu-thumbnails-with-imagemagick-edits/158564>\
**Category:** Rails\
**Created:** [January 24, 2009, 10:49pm UTC](https://www.ruby-forum.com/t/reprocess-attachment-fu-thumbnails-with-imagemagick-edits/158564 "2009-01-24T22:49:39Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![timgremore](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/t/e9c0ed/32.png) [@timgremore](https://www.ruby-forum.com/u/timgremore)\
**Post date:** [January 24, 2009, 10:49pm UTC](https://www.ruby-forum.com/t/reprocess-attachment-fu-thumbnails-with-imagemagick-edits/158564/1 "2009-01-24T22:49:39Z")

</div>

I’m trying to modify product images when a user marks a product as  
“sold” and I am able to modify the original image file successfully,  
but when I try to reprocess the thumbnails, my ImageMagick  
modifications don’t stick. Here is what I’ve got going so far:

def before\_save  
if self.sold\_changed? && self.sold?  
for photo in self.photos  
imagelist = Magick::ImageList.new  
imagelist.read(File.join(RAILS\_ROOT, “public”,  
photo.public\_filename), File.join(RAILS\_ROOT, “assets”, “sold.png”))  
imagelist.flatten\_images.write(photo\_file)  
photo.save!  
end  
end  
end

Does anyone know why calling ‘photo.save!’ would discard my  
ImageMagick changes? When I try the same function without calling  
photo.save!, my original image is modified exactly as I intend but the  
thumbnails are not updated.

If anyone has a suggestion, please let me know. Thanks in advance!
