In paperclip.rb (lib/paperclip.rb), in a block of comments regarding the has_attached_file
method, on line 251 (in version 2.3.3), it reads regarding the :convert_options
hash:
NOTE: Strings supplied to :convert_options are split on space in order to undergo shell quoting for safety. If your options require a space, please pre-split them and pass an array to :convert_options instead.
I need to pass an option -unsharp 1x2+1+.10
to Imagemagick, but can't figure out how / don't know what it means to pre-split the string.
I've tried:
:eightythumb => ['-antialias', '-thumbnail', '-unsharp 1x2+1+.10']
:eightythumb => ['-antialias', '-thumbnail', '-unsharp', '1x2+1+.10']
:eightythumb => ['-antialias', '-thumbnail', ['-unsharp', ' ', '1x2+1+.10']]
:eightythumb => ['-antialias', '-thumbnail', ['-unsharp', '+' '1x2+1+.10']]
update: have also tried
:eightythumb => ['-antialias', '-thumbnail', ['-unsharp', '1x2+1+.10']]
but they all get sent to Imagemagick from Paperclip as '-antialias' '-thumbnail' '-unsharp' '1x2+1+.10'
which throws an error since -unsharp
and 1x2+1+.10
aren't in the same string.
final update:
My error stemmed from -thumbnail requiring a dimension argument and had nothing to do with splitting the string. You can pass options to Imagemagick like this:
开发者_如何学运维:convert_options => { :eightythumb => ['-thumbnail 80x80', '-antialias', 'unsharp 1x2+1+.10'] }
and they'll go through just fine.
I think it means that it's looking for something like this:
:eightythumb => ['-antialias', '-thumbnail', '-unsharp 1x2+1+.10']
If you pass a single string, it will split it at whitespace characters. If you pass it an array of strings, it will treat each as a complete option.
Update: What happens if you add the escape characters yourself? As in '-unsharp\ 1x2+1+.10'
.
精彩评论