处理允许将上传的pdf转换为png的项目。这是我到目前为止所得到的:
class MyModel < ActiveRecord::Base
has_attached_file :attachment1,
styles: { image: ["1125x1500", :png] },
default_url: "/images/missing.png",
:convert_options => { density: "1050", quality: "1050" }
{other stuff}
end
convert_options
似乎不起作用,因为调整密度和质量似乎不会对图像产生任何影响。我担心我在这里没有使用正确的语法。
答案 0 :(得分:0)
convert_options使用键作为图像样式,值是选项字符串:
class MyModel < ActiveRecord::Base
has_attached_file :attachment1,
styles: { image: ["1125x1500", :png] },
default_url: "/images/missing.png",
:convert_options => { image: "-density 1050 -quality 1050" }
{other stuff}
end