I've recently installed paperclip and image magick in Rails 3. Both seem to be installed properly (running identity version confirms that image magick has been installed)
When trying to upload images, I'm always confronted with an error about processing the thumbnail. The few solutions I did see mentioned adding the output format ("after adding the desired output format to the style: :medium => ["300x300>", :png]
the error vanishes.") but I don't know what the means.
I feel like this line (in environment.rb) might cause an issue
Paperclip.options[:command_path] = "C:/Program Files (x86)/ImageMagick-6.7.4-Q16/"
My model looks like this:
...
has_attached_file :upload, :styles => { :medium => "200x200#", :thumb => "100x100#" }, :default_url => "/images/:style/missing.png"
...
And the form for submission looks like this:
<%= form_for :post, @post, :html => {:multipart => true} do |f| %>
...
<%= f.submit 'Submit'%>
<%= f.file_field :upload %>
<% end %>
While my migration looks like:
class AddUploadToPost < ActiveRecord::Migration
def self.up
add_column :posts, :upload_file_name, :string
add_column :posts, :upload_content_type, :string
add_column :posts, :upload_file_size, :integer
add_column :posts, :upload_updated_at, :datetime
end
def self.down
remove_column :posts, :upload_file_name
remove_column :posts, :upload_content_type
remove_column :posts, :upload_file_size
remove_column :posts, :upload_updated_at
end
end
我已移至虚拟linux盒,此盒已解决了该问题
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.