paperclip

jpegrecompress worker: `jpeg-recompress` not found;

随声附和 提交于 2019-12-13 03:00:42
问题 I recently installed the paperclip-optimizer gem in my Rails 4 app on Heroku. Whenever I attempt to save an uploaded image attachment, I get the following error: jpegrecompress worker: 'jpeg-recompress' not found; in my logs from Heroku, but not on localhost. I'm not sure what I'm missing. I can't seem to find a single StackOverflow post, blog post, or other resource on this problem. Here is my config/initializers/paperclip_optimizer.rb : Paperclip::PaperclipOptimizer.default_options = { skip

Ruby on Rails - How to delegate error messages from nested model

被刻印的时光 ゝ 提交于 2019-12-13 02:26:43
问题 class User include Mongoid::Document has_many :images accepts_nested_attributes_for :image end class Image include Mongoid::Document include Mongoid::Timestamps include Mongoid::Paperclip has_mongoid_attached_file :uploaded_image, :path => ":rails_root/public/uploads/:class/:id/:basename.:extension", :url => "public/uploads/" validates_attachment_content_type :uploaded_file, :content_type => "application/png", :message => "error massage" belongs_to :user delegate :url, :path, to: :uploaded

Error when uploading video to heroku

大兔子大兔子 提交于 2019-12-13 02:05:22
问题 I am using the paperclip and paperclip-av-transcoder in my rails app and I have gotten to the point where I can upload videos locally. But when I try it in heroku I get this error. Av::UnableToDetect (Unable to detect any supported library): I may have to add something to make it work with s3 but I had it working with images earlier so everything should be setup for s3. This is the code in my model class Classvideo < ActiveRecord::Base belongs_to :user has_attached_file :video, :styles => {

How to set Paperclip to process original image?

放肆的年华 提交于 2019-12-12 18:25:02
问题 Using Paperclip Gem in a Rails 4 project to attach an image and then clean out all exif data, like this: has_attached_file :image, styles: lambda{ |a| { large: ['800x', :png], thumb_340: ['340x340#', :png], thumb_180: ['180x180#', :png] } }, convert_options: { all: '-strip' } Problem is, convert_options isn't getting called on the original image. What's the best method for reprocessing (or pre-processing) the original to make sure that '-strip' gets called? 回答1: try this has_attached_file

Duplicate a rails object with associations and paperclip attachments

你。 提交于 2019-12-12 18:07:26
问题 I have an object with several associations. Some of these associated objects have paperclip-attachments stored at S3. If I duplicate the object and the associations it works fine but the attachments are not duplicated. This here works without getting the images: copy_salon = @salon.dup copy_salon.about_us_versions = @salon.about_us_versions.collect{|about_us| about_us.dup} I tried to get the image link like this: copy_salon = @salon.dup copy_salon.about_us_versions = @salon.about_us_versions

Rails Error - cannot load such file — aws-sdk (You may need to install the aws-sdk gem)

这一生的挚爱 提交于 2019-12-12 13:57:12
问题 I have a RoR app with image upload through paperclip and amazon s3. Everything was working fine until I decided to change the routes from myapp.com/id to myapp.com/model-name. Now I get the following error: LoadError cannot load such file -- aws-sdk (You may need to install the aws-sdk gem) . These changes involved changing the model, the controller, and the db. Model: class Major < ActiveRecord::Base attr_accessible :glance, :name, :image # Validations validates :glance, presence: true

Paperclip is not supporting .doc file

别来无恙 提交于 2019-12-12 13:33:19
问题 In rails 4.0.2, I am using paperclip gem to upload files. But it is not supporting .doc file. Below the file upload field, it is showing an error message as "has an extension that does not match its contents" In model, the validation for checking the content type is given below : validates_attachment_content_type :document, :content_type => ['application/txt', 'text/plain', 'application/pdf', 'application/msword', 'application/vnd.openxmlformats-officedocument.wordprocessingml.document',

rails 3, paperclip (& formtastic) - deleting image attachments

一世执手 提交于 2019-12-12 10:59:27
问题 I can't seem to find an example that is complete in all the components. I am having a hard time deleting image attachments Classes class Product has_many :product_images, :dependent => :destroy accepts_nested_attributes_for :product_images end class ProductImage belongs_to :product has_attached_file :image #(etc) end View <%= semantic_form_for [:admin, @product], :html => {:multipart => true} do |f| %> <%= f.inputs "Images" do %> <%= f.semantic_fields_for :product_images do |product_image| %>

Problem using the 'paperclip' gem and Ruby on Rails 3

荒凉一梦 提交于 2019-12-12 09:55:18
问题 I am using Ruby on Rails 3 on a MacOs running 'Snow Leopard' v1.6.5. I want to use the 'paperclip' gem so I included it in my Gemfile like this: gem 'paperclip', "~> 2.3" Then, in the Terminal I run the command: sudo bundle install The result is: ... Using paperclip (2.3.8) Using thor (0.14.6) Using railties (3.0.1) ... Your bundle is complete! Use `bundle show [gemname]` to see where a bundled gem is installed. that means that 'paperclip v2.3.8' is installed. Then I restarted 'apache' from

Rspec, Paperclip, Fabrication, valid object without saving to filesystem

戏子无情 提交于 2019-12-12 09:47:19
问题 I have a rails 3.2 app with paperclip 3.2 and I have a model that has a required paperclip attachment(thumb). How can I create valid objects without having the file saved to the filesystem or S3. What I currently have is below but this saves to the filesystem on each run. Is there a way to have a valid episode without uploading everytime? Model: class Episode include Mongoid::Document include Mongoid::Paperclip has_mongoid_attached_file :thumb validates_attachment_presence :thumb end Spec: