Im have just deployed a rails app which uses Paperclip to handle the file uploads to a linux ubuntu 10.04 server running apache2, passenger, rails 3.2.3 and ruby 1.9.3.
My setup worked perfectly fine in development, however now in production images never save.
i have commented out the following lines in production.rb so that rails deals with the file uploads and also tried using and installing XSendFile.
# Specifies the header that your server uses for sending files
# config.action_dispatch.x_sendfile_header = "X-Sendfile" # for apache
# config.action_dispatch.x_sendfile_header = 'X-Accel-Redirect' # for nginx
and my picture.rb
attr_accessible :photo_file_name, :photo_file_size, :photo_content_type, :photo, :splash_image
validates_presence_of :photo_file_name, :photo_content_type, :photo_file_size
has_attached_file :photo,
styles: {
thumb: "150x150>"
},
url: "/assets/splash_images/:id/:style/:basename.:extension",
path: ":rails_root/public/assets/splash_images/:id/:style/:basename.:extension"
validates_attachment_size :photo, :less_than => 25.megabytes
validates_attachment_content_type :photo, content_type: /image/
Does anyone know what could be going on? many thanks
Thanks Meduza and Hugo for pointing me in the right direction. To get the images uploading and saving successfully I had to install Imagemagick on the linux server and also give write permissions to the image path like so:
Append with sudo if not running from root
apt-get install imagemagick
apt-get install libmagick9-dev
gem install rmagick
chmod -R 777 app/app_name/public/assets/image_folder