I have paperclip installed and functioning, except that it is only saving the original image, and not any of the resized versions. This is not the issue of the aspect ratio holding over the commanded sizing, about which there are several fixes on Stackoverflow.
I can't figure out where my code is wrong.
model:
has_attached_file :image, styles: { medium: "450x450" },
path: ":rails_root/public/system/:attachment/:id/:style/:filename",
url: "/system/:attachment/:id/:style/:filename"
migration file:
class AddAttachmentToPhotos < ActiveRecord::Migration
def change
add_attachment :photos, :image
end
end
The directory chain that is created when the first image is uploaded is as follows:
public/system/images/1/original
which is correct except that there should also be a public/system/images/1/medium
What am I doing wrong?
EDIT: I am using ruby 1.9.2, rails 3.2, and paperclip 3.4.1 Is there any other information that would help solve this issue?
From documentation (http://rdoc.info/gems/paperclip/file/README.md#Requirements):
ImageMagick must be installed and Paperclip must have access to it. To ensure that it does, on your command line, run
which convert(one of the ImageMagick utilities). This will give you the path where that utility is installed. For example, it might return/usr/local/bin/convert.
Also make sure you have it installed on your deployment machine, not only on your development.
If you have it installed, we would probably need fragment of your logs when you try to attach image to your model, like this from rails console:
model.image = File.open('image.png')
model.save
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With