I'd like to insert arguement as text onto the image file that user uploads.
With the code below, It doesn't work. It just saves image without any effect.
I'm using the gem called 'papaerclip' for uploading.
comment.rb
#paperclip
has_attached_file :comment_icon,
:styles => {
:thumb=> "100x100>",
:small => "400x400>" },
:convert_options => {
:all => " -stroke '#000C' -strokewidth 2 -annotate 0 'Faerie Dragon' -stroke none -fill white -annotate 0 'Faerie Dragon'" }
How can I insert text to the bottom of images like this example?
How comment.rb should be written?
ImageMagick code
convert dragon.gif -gravity south \
-stroke '#000C' -strokewidth 2 -annotate 0 'Faerie Dragon' \
-stroke none -fill white -annotate 0 'Faerie Dragon' \
anno_outline.jpg
It doesn't like the single quotes you have in your convert_options. Try using:
' -gravity south -stroke "#000C" -strokewidth 2 -annotate 0 "Faerie Dragon" -stroke none -fill white -annotate 0 "Faerie Dragon"'
instead. I am using Paperclip 3.2.0 and was able to get it to apply the text by changing the quotes.
Here is my image attribute:
has_attached_file :avatar,
:styles => {:large => "300x300", :medium => "140x140>", :thumb => "100x100>", :tiny => "50x50" },
:storage => :s3,
:s3_credentials => "#{Rails.root}/config/amazons3.yml",
:path => "avatars/:id/:style_:filename",
:convert_options => {
:all => ' -gravity south -stroke "#000C" -strokewidth 2 -annotate 0 "Faerie Dragon" -stroke none -fill white -annotate 0 "Faerie Dragon"' }
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With