0
我基本上想要做的就是使用jcrop裁剪圖像,然後使用這些尺寸旋轉圖像-30度並保存縮略圖。然而,rmagick會創建額外的像素,因爲旋轉後沒有縮放。我想知道如何做到這一點。rmagick旋轉並調整大小以符合回形針中的指定尺寸
# 150 x 150 is the final cropped image I want for my thumb(nails)
# :croppable is a file I use that takes the original and adds white padding in a 1200x1200
# file size so I can actually crop with white space available (you can't crop outside the
# original dimensions of the file)
has_attached_file :photo, :styles => {
:thumb => { :geometry => "150x150#", :format => :jpg, :processors => [:cropper] },
:general => ["150x375", :jpg],
:show => ["x425", :jpg],
:croppable => ["1200x1200>", :jpg]
},
:url => "/assets/w/:style/:w",
:path => ":rails_root/public:url",
:default_url => ":w_default",
:default_path => ":rails_root/public:w",
:default_style => :show,
:convert_options => {
:thumb => '-gravity center -rotate -30',
:croppable => '-gravity center -extent 1200x1200',
:general => '-gravity center -extent 150x375 -quality 95',
:all => '-quality 100 -antialias -flatten -background white -interlace Plane -unsharp 0.3x0.3+5+0'
},
:processors => [:thumbnail, :compression]
我最終想要做的是旋轉通過CSS預覽圖像變換,使預覽實際顯示縮略圖的樣子裁剪後。在這一點上,我不確定如何獲得我想要的回形針時保存縮略圖並旋轉它。