Reputation: 31
Imagemagic gives me error while uploading a .txt
or a .html
file, whereas I can successfully upload a image(.png
, .jpeg
)
Error: Project files files
Paperclip::Errors::NotIdentifiedByImageMagickError
Model Code:
class ProjectFile < ActiveRecord::Base
belongs_to :project
has_attached_file :files, :styles => {:medium=>"300x300>",:thumb=>"100x100>"},
:storage => :s3,
:s3_credentials => File.join(Rails.root, 'config', 'aws.yml'),
:path => ":class/:attachment/:id/:style.:extension"
end
Can anyone help me out with error.
Upvotes: 0
Views: 98
Reputation: 31
Hey I resolved the issue, I was uploading a .txt and .pdf file and i had specified styles attribute while uploading the file. Following is code:
class ProjectFile < ActiveRecord::Base
belongs_to :project
has_attached_file :files,
:storage => :s3,
:s3_credentials => File.join(Rails.root, 'config', 'aws.yml'),
:path => ":class/:attachment/:id/:style.:extension"
end
Removing style attribute resolved my problem. :)
Upvotes: 1