My crop - how to update thumbnails

Hi,
I made ruby do the resize based on JS cropper. The image is
cropped and can be written to drive, but I dont know how to
oryginal image and thumbs.

Here is the code:

def my_crop(args={})
x1 = args[:x1].to_i
y1 = args[:y1].to_i
new_width = args[:width].to_i
new_height = args[:height].to_i

with_image do |img|
  @data = img.crop(x1, y1, new_width, new_height)
end

@data.write("c:/resized.jpg") # here I gvet the iamge correctly
# this does not work, how to make @data update thumbs?
attachment_options[:thumbnails].each do |suffix, size|
  create_or_update_thumbnail(@data, suffix, *size)
end

end

Its based on blog post from http://blog.onmylist.com, but
the oryginal code did not work for me.

Is there a way to update the thumbs?

Cheers,
Tomasz Bak