只用载波处理原始文件
Process only original file with carrier wave
我正在使用 carrierwave 上传图像,同时还创建了缩略图版本。我也在尝试仅将水印应用于原始文件(而不是缩略图)。
这就是我正在尝试的:
process :watermark
version :thumb do
process resize_to_fit: [80, 50]
process :quality => 60
end
protected
def watermark
if self.version_name.nil?
< apply watermark here >
end
end
end```
The watermark is applied to all versions, including the thumbnail. Is ether a way to achieve this without creating another version named :original ?
Thanks!
One important thing to remember is that process
is called before versions are created. This can cut down on processing cost.
在您的情况下,先应用水印,然后生成缩略图。
我认为最好的解决方案是:
- 创建附加版本 (
:original
)
- 删除上传的原始文件,只保留文件的
thumb
和 original
版本 (source)
我正在使用 carrierwave 上传图像,同时还创建了缩略图版本。我也在尝试仅将水印应用于原始文件(而不是缩略图)。
这就是我正在尝试的:
process :watermark
version :thumb do
process resize_to_fit: [80, 50]
process :quality => 60
end
protected
def watermark
if self.version_name.nil?
< apply watermark here >
end
end
end```
The watermark is applied to all versions, including the thumbnail. Is ether a way to achieve this without creating another version named :original ?
Thanks!
One important thing to remember is that
process
is called before versions are created. This can cut down on processing cost.
在您的情况下,先应用水印,然后生成缩略图。
我认为最好的解决方案是:
- 创建附加版本 (
:original
) - 删除上传的原始文件,只保留文件的
thumb
和original
版本 (source)