2

モデルでペーパークリップ圧縮を使用していますが、s3 にアップロードする前に画像を webp に変換したいと考えています。しかし、変換は行われていません。画像の URL にアクセスしているときに、まだ png 画像を取得しています。

  class ImageTesting
  include Mongoid::Document
  include Mongoid::Timestamps
  include Paperclip::Glue

   has_attached_file :image, :processors => [:thumbnail, :compression],
  :styles => {
                :xxlarge_square => ["640x640>",  { lossless: true } , :webp],
                :xlarge_square => ["480x480>",  { lossless: true } , :webp],
                :large_square => ["240x240>",  { lossless: true } ,:webp]
              },
   :convert_options => {
      :all => '-quality 80'
    },

   :storage => :s3,
   :s3_credentials => 'xxx',
   :s3_host_name => 'xxx',
   :s3_host_alias => 'xxx',
   :url => ':s3_alias_url',
   :path => ":class/:attachment/:id/:style"

  field :image_file_name, type: String
  field :image_updated_at, type: DateTime
  field :image_content_type, type: String
  field :image_file_size, type: Integer
end
4

1 に答える 1

0

format: :webpハッシュで使用してみてください:

 has_attached_file :image, :processors => [:thumbnail, :compression],
   :styles => {
                 :xxlarge_square => ["640x640>",  { lossless: true, format: :webp }],
                 :xlarge_square => ["480x480>",  { lossless: true, format: :webp }],
                 :large_square => ["240x240>",  { lossless: true, format: :webp }]
               },     
于 2015-05-08T14:09:44.007 に答える