Forum: Ruby on Rails My crop - how to update thumbnails

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.
Tom B. (Guest)
on 2008-11-11 01:38
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
This topic is locked and can not be replied to.