Forum: Ruby on Rails reprocess attachment_fu thumbnails with ImageMagick edits

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
E0c703ed0fdb83136e2ced9ef3af5d9a?d=identicon&s=25 timgremore (Guest)
on 2009-01-24 22:49
(Received via mailing list)
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!
This topic is locked and can not be replied to.