5

ユーザーがアップロードする画像ファイルに、テキストとして議論を挿入したいと考えています。
以下のコードでは、動作しません。効果なしで画像を保存するだけです。
アップロードには「papaerclip」という gem を使用しています。

コメント.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'" }

この例のように、画像の下部にテキストを挿入するにはどうすればよいですか? comment.rb
は どのように記述すればよいですか?

ImageMagick コード

  convert dragon.gif -gravity south \
          -stroke '#000C' -strokewidth 2 -annotate 0 'Faerie Dragon' \
          -stroke  none   -fill white    -annotate 0 'Faerie Dragon' \
          anno_outline.jpg
4

1 に答える 1

2

convert_optionsにある一重引用符は好きではありません。使用してみてください:

' -gravity south -stroke "#000C" -strokewidth 2 -annotate 0 "Faerie Dragon" -stroke none -fill white -annotate 0 "Faerie Dragon"'

代わりは。私はPaperclip3.2.0を使用しており、引用符を変更することでテキストを適用することができました。

これが私の画像属性です:

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"' }
于 2013-01-03T14:53:01.430 に答える