paperclip

Paperclip has_attached_file not working with Rails establish_connection

北慕城南 提交于 2019-12-11 04:55:56
问题 I am trying to access images from paperclip using establish_connection. Here is my code of model article.rb class Article < ActiveRecord::Base if Rails.env.production? establish_connection SECONDARY_DB_CONFIG else establish_connection "article_#{Rails.env}" end has_many :assets, dependent: :destroy accepts_nested_attributes_for :assets validates_associated :assets end file asset.rb class Asset < ActiveRecord::Base if Rails.env.production? establish_connection SECONDARY_DB_CONFIG else

Paperclip images not Displaying in rails app

本小妞迷上赌 提交于 2019-12-11 04:34:58
问题 I'm using paperclip to upload images to the site but when I do, it shows the image placeholder with a question mark, not the image itself. What Am I doing wrong? In the model: attr_accessor :photo_file_name attr_accessor :photo_content_type attr_accessor :photo_file_size attr_accessor :photo_updated_at attr_accessible :photo #paperclip------------------------------- has_attached_file :photo, :url => "/:attachment/:id/:style/:basename.:extension", :path => ":rails_root/public/:attachment/:id/

Credentials missing when uploading photos with Paperclip and Amazon s3

安稳与你 提交于 2019-12-11 04:31:23
问题 I'm having issues uploading photos to S3 using Paperclip. The photos download to the site correctly, but trying to upload new ones gives a "Credentials Missing" message. I've tried resetting my S3 keys, tried to change access to the variable in the coding, not of which worked. I am almost certain it is the photo issue, because if I submit the form without the photo, it submits correctly (albeit with no photo). Here is the model (one of two models, but the script is the same): class Outfit <

creating a form for deleting uploads that belongs to products

守給你的承諾、 提交于 2019-12-11 04:23:57
问题 I did the multiple uploads with paperclip based on this app https://github.com/websymphony/Rails3-Paperclip-Uploadify and it's working fine, but now I need to build a form where user can delete some of this uploads. I have this form for deleting the uploads for one product <%= form_for @product, :html => { :method => :put }, :html => { :multipart => true } do |f| %> <h3 id="photos_count"><%= pluralize(@product.uploads.size, "Photo")%></h3> <%= f.fields_for :uploads do |photo_fields| %> <% if

Error after installing aws-sdk

百般思念 提交于 2019-12-11 03:56:10
问题 I am trying to get paperclip to work with S3 and my views are throwing an error: cannot load such file -- aws-sdk (You may need to install the aws-sdk gem) I have rails configured this way: Gemfile ... gem "paperclip", "~> 3.0" gem 'aws-sdk' ... Model user.rb ... has_attached_file :avatar, :styles => { :medium => "300x300>", :thumb => "100x100>" }, :storage => :s3, :bucket => ENV['lumeo-dev'], :s3_credentials => "lumeot/config/aws.yml", :path => "/:style/:id/:filename" ... config/aws.yml

Problem showing the 'size' attribute for a 'file_field' using Ruby on Rails 3

戏子无情 提交于 2019-12-11 03:33:35
问题 I am using Ruby on Rails 3 and I have a form like this: <%= form_for(@user, ... ) do |f| %> ... <%= f.file_field :avatar, :id => "test_id", :style => "display: block", :size => "13" %> ... <% end %> When I go to see the source of the page, this is the HTML code generated: <input type="file" style="display: block;" name="user[avatar]" id="test_id"> that means the 'size' attribute there isn't. I tried on Firefox, Chrome and Safari: same output, but it seems to have everything set correctly. Is

How do I improve Rails / Paperclip image compression inside or ImageMagick / Rmagick?

喜夏-厌秋 提交于 2019-12-11 03:26:06
问题 I'm using Paperclip to crop an image in rails. I use these convert options: "-quality #{attachment.quality} \ -crop #{attachment.width}x#{attachment.height}+#{attachment.x}+#{attachment.y}" If I crop and save the image as a JPEG with 65% quality the image comes out awful and still has quite a large image size. However if I use Image Bucket Pro and do the exact same thing, the JPEG comes out looking much better and with a smaller file size. What can I do to Paperclip (ImageMagick / Rmagick) to

Paperclip and S3: Multiple thumbnail sizes not saving

微笑、不失礼 提交于 2019-12-11 03:13:09
问题 I'm using Paperclip to handle image uploads for my Rails app, and it's working great when I use system storage: multiple thumbnail sizes ("styles" in Paperclip parlance) are saved to file, and I can access any of them by passing the style name to the url method. When I set up the app to store images on S3 (using the aws-s3 gem), however, only one image is stored in my S3 bucket. For what it's worth, only the last style listed is stored. So, if in my model, I've got: has_attached_file :photo,

Uploading to S3 on Heroku with Paperclip (delayed_job question)

人盡茶涼 提交于 2019-12-11 03:09:17
问题 I'm trying to upload to a portfolio app I've built, specifically trying to find where to hook delayed_job into the process. It all works otherwise. Right now it returns undefined method 'call' for #<Class:0xae68750> on app/controllers/portfolio_items_controller.rb:18:in 'create' so here's my model and that portion of the controller... anyone see anything that could be going wrong? The hook I'm using now I got from this blog: http://madeofcode.com/posts/42-paperclip-s3-delayed-job-in-rails

Paperclip.Run and FFMPEG exit codes

半城伤御伤魂 提交于 2019-12-11 02:53:04
问题 I'm writing a paperclip processor that class ffmpeg using the Paperclip.run command. Currently, that line throws an Cocaine::CommandLineError stating Command '/opt/local/bin/ffmpeg -i "/tmp/stream20110729-2442-133evp0.mp3" "/tmp/stream20110729-2442-133evp020110729-2442-15k6sr4.ogg" 2>/dev/null' returned 1. Expected 0 This doesn't really tell me a lot about what's going on, and I can't find anything about FFMPEG error code 1. I need to find more information about what's happening in FFMPEG,