我正在以这种方式处理PDF文件的缩略图:
version :thumb do
process :resize_to_limit => [260, 192]
process :convert => :jpg
process :set_content_type
end
def set_content_type(*args)
self.file.instance_variable_set(:@content_type, "image/jpeg")
end
但当PDF文件是多页时,它会为一个jpg文件中的所有页面生成缩略图。
我有个有趣的问题。产品页的缩略图大小设置为175 x 169,而目录产品的缩略图大小为362 x 257像素。我使用以下代码在商店的标题中显示产品:
<?php echo do_shortcode( '[product sku="62-1166"]' );
wp_reset_postdata();
?>
这很好用。然而,在商店页面上,当显示该特定产品时(其中一个显示在标题中),其缩略图看起来是362 x 257像素,而不是175 x 169像素。如何解决这个问题?
下面是演示链接:
阿玛尔。