Override in the photos model
# Anchor image resizing to top to avoid cutting off heads!
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))
img.crop_resized!(size, size, Magick::NorthGravity)
else
img.change_geometry(size.to_s) { |cols, rows, image|
image.crop_resized!(cols, rows, Magick::NorthGravity)
}
end
self.temp_path = write_to_temp_file(img.to_blob)
end
On Feb 14, 7:54 am, Bruno Bornsztein <[email protected]>
wrote:
> I think there's a 'gravity' setting you can pass:
>
> http://www.imagemagick.org/RMagick/doc/imageattrs.html#gravityhttp://www.imagemagick.org/RMagick/doc/imusage.html#geometry
>
> On Sat, Feb 14, 2009 at 9:14 AM, Sachin <[email protected]> wrote:
>
> > Hi,
>
> > When someone uploads image with height greater than(almost twice) the
> > width, the thumbnail generated points to the center of the image,
> > which misses the face, as mostly face will be in upper portion of the
> > image.
> > I know that having a image cropper javascript for allowing users to
> > select portion for thumbnail would be a bigger task, but if we could
> > quickfix or hack a solution of generating thumbnail with upper portion
> > of the image with rmagick/image-magick that would be great.
>
> > I tried finding any settings/config about rmagick/imagemagick but was
> > not successful.
>
> > Has anyone tried this?
>
> > Please point me to correct direction.
>
> > Thanks,
> > Sachin
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"CommunityEngine" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/communityengine?hl=en
-~----------~----~----~----~------~----~------~--~---