I use custom Paperclip styles to resize some images.
Custom style is defined as follows:
has_attached_file :image_preview,
:styles => lambda { |a|
{
:original => "#{a.instance.model.aspect_ratio_width.to_f/2.54*300}x#{a.instance.model.aspect_ratio_height.to_f/2.54*300}"}
}
When the image is visible, the image resized the width parameter, but there was never a height parameter!
The logs also show that during the ImageMagick operation, only the width parameter was taken into account -
Command :: file -b --mime '/tmp/46711c9258f556a83aa382084f5014d120160804-14501-h9qo6j.png'
Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/46711c9258f556a83aa382084f5014d120160804-14501-16cbj3b.png[0]' 2>/dev/null
Command :: identify -format %m '/tmp/46711c9258f556a83aa382084f5014d120160804-14501-16cbj3b.png[0]'
Command :: convert '/tmp/46711c9258f556a83aa382084f5014d120160804-14501-16cbj3b.png[0]' -auto-orient -resize "1110" '/tmp/caba5ed9a9c1d9623acb7738fd6b8dda20160804-14501-5sjqq1'
[paperclip] saving /cases/image_previews/000/000/045/original/Goku-Blue.png
How can i do this?
source
share