Attachement_fu : resize_to's not working

with the following asset.rb model :

has_attachment :content_type => :image,
:storage => :file_system,
:processor => ‘Rmagick’,
:path_prefix => ‘/public/assets/’,
:size => 0.kilobytes…100000.kilobytes,
:max_size => 10.megabytes,
:resize_to => ‘580x400>’,
:thumbnails => { :panorama_cropped =>
‘580x400!’, :panorama => ‘580x400>’, :medium => ‘250x150>’,
:medium_cropped => ‘250x150!’, :thumb => ‘75x60!’ }

and rmagick’s attachment_fu processor hacked like this :

def resize_image(img, size)
size = size.first if size.is_a?(Array) && size.length == 1 &&
!size.first.is_a?(Fixnum)
if size.is_a?(Fixnum) || (size.is_a?(Array) &&
size.first.is_a?(Fixnum))
size = [size, size] if size.is_a?(Fixnum)
img.crop_resized!(*size)
else
img.change_geometry(size.to_s) { |cols, rows, image|
image.crop_resized!(cols, rows) }
end
self.temp_path = write_to_temp_file(img.to_blob)
end

i get everything working as expected on my local machine, that is to
say, even if a have a 300x200 image, i get a 580x400 panorama_cropped
image as set up in the model.

putting it the server, if the image fits in a 580x400 sizes, nothin is
done for this panorama_cropped setup, and i just get the original format
for this, as from the above would be 300x200.

i might have to do with the way the environnement has been set, but I
just can’t figure out exactly from here it could come.

thanks a lot for any help about it.

I ran into a similar problem with imagescience - it doesn’t seem to obey
the “!” convention in rmagick geometry strings. However, if you just
pass an array as the dimensions, it has the same effect:

:thumb => [580, 400]

Are you sure your server is using rmagick? If you didn’t set it up
yourself, someone may be chosen to use imagescience instead.

Bryan M. wrote:

I ran into a similar problem with imagescience - it doesn’t seem to obey
the “!” convention in rmagick geometry strings. However, if you just
pass an array as the dimensions, it has the same effect:

:thumb => [580, 400]

Are you sure your server is using rmagick? If you didn’t set it up
yourself, someone may be chosen to use imagescience instead.

The cropping’s fine… wich reading your answer is not that obvious the
way it has been set up.

what i don’t get is how to have my 300x200 scaling proportionnaly to a
580xsomething px area;
i’m looking for having the same height for every images for every
thumbnails’ sizes specified, 400 for panorama, 150 for medium, etc…

for the moment, if the image is under for example the 580x400
dimensions, it is not processed at all and my @img.public_filename() and
@img.public_filename(:panorama) are both the same.

If I’m not stepping on your thread, this is a similar question I
posted two days ago without response:

I am running Rmagick and Imagemagick just fine on my Windows XP
machine ( thanks Rick ) and all is well in the world.
I’ve moved the identical source deck to another machine that appears
to have an identical work environment ( pathing to imagemagic ) and
the application saves photos just fine, but it doesn’t do the
THUMBNAIL thing? The photo is left in its respective subdirectory of /
images with the correct name ( photo_thumb.jpg ) but it has exactly
the same weight (size) as when it was processed by Rmagick/
Imagemagick.

Could someone venture a guess as to where I might look to explore this
mystery?

Thank you,
Kathleen

On Sep 1, 12:59 am, Benjamin B. [email protected]

I have the same thing on another machine too (fedora), but with this I
assume the imagemagick install (wich seemed to work) is just wrong. I
just gave up and wil try to reinstall it.

For the moment i’m looking for having a :resize_to working, wich is
broke for some reasons.

[email protected] wrote:

If I’m not stepping on your thread, this is a similar question I
posted two days ago without response:

I am running Rmagick and Imagemagick just fine on my Windows XP
machine ( thanks Rick ) and all is well in the world.
I’ve moved the identical source deck to another machine that appears
to have an identical work environment ( pathing to imagemagic ) and
the application saves photos just fine, but it doesn’t do the
THUMBNAIL thing? The photo is left in its respective subdirectory of /
images with the correct name ( photo_thumb.jpg ) but it has exactly
the same weight (size) as when it was processed by Rmagick/
Imagemagick.

Could someone venture a guess as to where I might look to explore this
mystery?

Thank you,
Kathleen

On Sep 1, 12:59�am, Benjamin B. [email protected]