5

画像の作成時にPaperclipgemで作成するために定義したさまざまな:stylesは、アップグレード後に機能しなくなりました。これらのファイルはまったく作成されていませんが、「original」が(唯一の)です。

class Image < ActiveRecord::Base
  belongs_to  :member
  has_many    :article_images, :dependent => :destroy
  has_many    :articles, :through => :article_images

  has_many    :member_photos, :dependent => :destroy
  has_one     :member_avatar, :dependent => :destroy

  validates_presence_of :member_id

  after_validation do |resource| 
    #since paperclip doesn't give a damn error message like an idiot
    resource.errors[:image] = resource.errors[:image_file_name] ?  resource.errors[:image_file_name] : resource.errors[:image_content_type]
  end

  before_save do |resource| 
    #set name to filename if no name sent
    resource.name = resource.image_file_name.split('.')[0].titleize if resource.name.blank? 
  end

  scope :for_slideshow, limit(5) 

  has_attached_file :image, 
    :styles => { 
      :original    => "1100x1100", #overwrites orig, for file storage efficiency
      :x_large     => "900x900",
      :large       => "600x600",
      :medium      => "300x300>",
      :thumb_1     => "100x100#",
      :thumb_2     => "50x50#",
      :thumb_3     => "25x25#"
      #To refresh image thumbs: rake paperclip:refresh CLASS=Image
    },
    :storage => :s3,
    :path => ":attachment/:id/:style.:extension",
    :s3_credentials => "#{::Rails.root}/config/s3.yml"

    #:url => "/system/:attachment/:id/:style/:filename"


  validates_attachment_content_type :image, :content_type=>['image/jpeg', 'image/png', 'image/gif', 'image/pjpeg', 'image/x-png'] #last two for IE 6-8
  validates_attachment_presence :image
  #validates_attachment_size :image, :less_than=>1.megabyte

end

ログには、これ以上の試行は表示されません。

  SQL (0.3ms)  INSERT INTO `images` (`caption`, `created_at`, `desc`, `image_content_type`, `image_file_name`, `image_file_size`, `image_updated_at`, `member_id`, `name`, `updated_at`) VALUES ('', '2013-02-18 06:34:55', '', 'image/jpeg', '525119_10151396740758260_611505697_n.jpeg', 111946, '2013-02-18 06:34:55', 719, '525119 10151396740758260 611505697 N', '2013-02-18 06:34:55')
[paperclip] Saving attachments.
[paperclip] saving images/4201/original.jpeg
[AWS S3 200 1.367095 0 retries] put_object(:acl=>:public_read,:bucket_name=>"mybucket.development/paperclip",:content_length=>111946,:content_type=>"image/jpeg",:data=>Paperclip::UploadedFileAdapter: 525119_10151396740758260_611505697_n.jpeg,:key=>"images/4201/original.jpeg")  

私は何が欠けていますか?

4

1 に答える 1

0

何らかの理由で、2.8 にダウングレードすると、この問題が「修正」されました。でも最新版にしたい…

于 2013-02-18T18:18:40.643 に答える