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
On Jul 29, 7:16 pm, Andy
<andym...-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
wrote:> 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}/publi...-2eVhCaBd0TMUI1C2+O+ouw@public.gmane.org_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
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Ruby on Rails: Talk" group.
To post to this group, send email to
rubyonrails-talk-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
To unsubscribe from this group, send email to
rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org
For more options, visit this group at
http://groups.google.com/group/rubyonrails-talk?hl=en
-~----------~----~----~----~------~----~------~--~---