Can't crop images using ImageMagick

I’m using Attachment_Fu to save several thumbnails of a photo
(resizing with ImageMagick)

But when I try to crop them, nothing seems to happen to the file I
want to drop and no error messages. I check the file timestamp of the
thumbnail I want to crop and it looks updated. What’s strange is that
ALL the other thumbnails and the original image’s file timestamps are
updated to.

Am I missing something here? At one point in this project I thought I
successfully resized or cropped an image this way, but I can’t seem to
do it now.

Also, the files are in the shared “system” directory of a Capistrano
deployed server.

Here’s my code:

require ‘RMagick’

top_square = params[:top_square].to_d
left_square = params[:left_square].to_d
width_square = params[:width_square].to_d
height_square = params[:height_square].to_d

source_file = “#{RAILS_ROOT}/public#{@photo.public_filename}”
destination_file = “#{RAILS_ROOT}/public#{city_photo.public_filename}”

img = Magick::Image.read(source_file).first
img.crop!(left_square, top_square, width_square, height_square)
img.write destination_file

Thanks,
Andy

OK, it looks like if I switch the destination file to the same as the
source file, it works.

But I want to use the full size as the source and then write to a
thumbnail.

Any ideas?

Thanks,
Andy