我在導軌上使用紅寶石中的PaperClip來處理模型的圖像上傳。除了不一致的圖像尺寸處理之外,它運行良好。在導軌上的PaperClip紅寶石上傳不一致的圖像大小
見這個例子:
查看該圖片多遠權利比在中間,左邊的圖片更大?
我需要確定爲什麼會發生這種情況。
這是我開發的回形針配置:
#Paperclip storage locally and specify location of imagemagick
Paperclip.options[:command_path] = "/usr/local/bin/"
PAPERCLIP_STORAGE_OPTS = {
:styles => { :thumb => '100x100#', :medium => '450x300>', :large => '600x400>'},
:convert_options => { :all => '-quality 100' },
:processor => [ :cropper ]
}
# Raises error for missing translations
# config.action_view.raise_on_missing_translations = true
end
,我使用下面的代碼位顯示這些圖片:
<div class="container">
<% count = 0 %>
<% results.each do |event| %>
<% if count == 3 %>
<div class="row"></div>
<% end %>
<div class="col-xs-12 col-md-4">
<ul class="deals">
<li class="impression">
<%= link_to(event) do %>
<%= image_tag event.logo.url(:medium) %>
<div>
<h2><%= event.className %></h2>
<div><%= event.company_name %></div>
<table>
<tbody>
<tr>
<td>
<span>£<%= event.ppt %></span>
£<%= event.ppc %></td>
<td>4 bought</td>
</tr>
</tbody>
</table>
</div>
<% end %>
</li>
</ul>
</div>
<% count = count +1 %>
<% end %>
</div>
當我調查的實際IMG大小的HTML渲染後他們如下:
網球圖片:334 x 209(原始圖像尺寸爲1024 x 640)
計算機培訓PIC:334 X 209(原始圖像尺寸爲1600×1000)
尊巴PIC:334 X 223(原始圖像尺寸1280 * 854)
出於某種原因,尊巴圖象是14個像素比其他人長?爲什麼會發生這種情況 - 爲什麼回形針不能在此配置中一直調整大小?或者它是否與頁面的CSS?!