paperclip

paperclip Error while determining content type: Cocaine::CommandNotFoundError in Rails 3.2.1

给你一囗甜甜゛ 提交于 2019-12-24 07:23:29
问题 I tried to use the code given here to upload and crop images using Paperclip.I am able to upload image and also the image is cropped but without selection area. The console gives the following error : [paperclip] Error while determining content type: Cocaine::CommandNotFoundError I have tried solutions given on other articles of SO like this and this, but none of them solved this problem. Any other suggestions are most welcomed. NOTE : I am working on Windows 7. Gems installed are : gem

Paperclip, set path outside of rails root folder

╄→尐↘猪︶ㄣ 提交于 2019-12-24 06:21:41
问题 I have two separate rails apps, say MyApp and MyAppAdmin. In MyAppAdmin there is ability to attach images with paperclip gem, this images should be available on the first app (MyApp). F.e. I may add a user avatar in MyAppAdmin, and it should be displayed in MyApp. How can I set path for the images that would point to common 'shared' folder, which these two apps can use? I tried to use something like path: "/tmp/shared" in my config.yml, but it didn't work. It just adds to the default

Paperclip, set path outside of rails root folder

蹲街弑〆低调 提交于 2019-12-24 06:21:09
问题 I have two separate rails apps, say MyApp and MyAppAdmin. In MyAppAdmin there is ability to attach images with paperclip gem, this images should be available on the first app (MyApp). F.e. I may add a user avatar in MyAppAdmin, and it should be displayed in MyApp. How can I set path for the images that would point to common 'shared' folder, which these two apps can use? I tried to use something like path: "/tmp/shared" in my config.yml, but it didn't work. It just adds to the default

Ruby on rails Unpermitted parameters: image

梦想与她 提交于 2019-12-24 01:56:08
问题 I'm trying to upload an image with paperclip gem, just now, my models are: My model class Advert < ActiveRecord::Base has_attached_file :image #accepts_nested_attributes_for :image end Part of my view: <%= form_for :advert do |f| %> <p> <%= f.label :image %><br> <%= f.file_field :image %> </p> <% end %> My Controller: def new logger.info "Processing the request New..." @advert = Advert.new end def create logger.info "Processing the request Create..." #logger.info JSON.parse( params[:advert]

Rails / Paperclip - skipping image processing

我的梦境 提交于 2019-12-24 01:54:27
问题 How can I skip post processing based on a virtual attribute? My virtual attribute is always nil in the before_asset_post_process callback Create attachment = Attachment.create(asset: File.open(file.png), :skip_thumb => 1) Attachable model class Attachment < AR::Base attr_accessor :skip_thumb has_attached_file :asset, :styles => lambda { |attachment| { :thumb => ["100>", 'jpg'] , :thumb_big => ["200>", 'jpg'] } before_asset_post_process :proceed_or_cancel def proceed_or_cancel #self.skip_thumb

Rename image using associated model - Paperclip

三世轮回 提交于 2019-12-24 00:59:09
问题 Code In my image model: has_attached_file :pic before_post_process :rename_pic before_save ->{ p 'before_save ----------------' } after_post_process ->{ p 'after_post_process --------------' } def rename_pic p 'en imagen' p self p 'en imagen' end In service that has many images: # don't use accepts_nested_attributes_for before_save :create_images attr_accessor :images_attributes def create_images # images_attributes example value: { "0"=> {img_attrs}, "1" => {img_attrs1} } images_attributes

Supplying a variable string to model for Paperclip Imagemagik resizing

随声附和 提交于 2019-12-24 00:34:18
问题 I'm using paperclip to upload some images which get resized. One of which I want to be cropped one of five ways... Anyway, I worked out what the strings to crop should all look like, by changing them by hand, but now i need to make that dynamic so that paperclip can crop based upon what the user wants... The problem is that I'm getting undefined local variable or method `params' for #<Class:0x00000105b228d8> I feel pretty sure that this is because I'm attempting to bend rails to my will.

Paperclip unable to change default path

我们两清 提交于 2019-12-23 22:33:33
问题 I'm having a similar problem to this issue, except I'm unable to modify the path at all. I'm using Spree 2.2 which uses paperclip 3.4.2 I'm trying to modify the paperclip defaults to change the image path. All of the other configuration is working. Myapp::Application.configure do config.paperclip_defaults = { :storage => :s3, :s3_protocol => 'https', :s3_host_name => "s3-eu-west-1.amazonaws.com", :path => ":rails_root/public/:attachment/:id/:style/:basename.:extension", :url => "/:attachment/

Copy All Styles of a Paperclip Attachment to New Object (S3)

放肆的年华 提交于 2019-12-23 20:17:09
问题 I have a model that uses Paperclip to handle images. When the image gets uploaded a preview is made for some javascript cropping and then a thumbnail and preview sizes are made from the chosen cropping. Giving us 3 images on S3 total: Original Image Preview (from the user selected cropping) Thumb (from the user selected cropping) The code in the model for the attachment is: has_attached_file :picture, ASSET_INFO.merge( :whiny => false, :styles => { :thumb => '200>x200#', :preview => '400x300>

Use Google Docs Viewer to open document from rails app (paperclup, cloudfiles)

孤人 提交于 2019-12-23 19:51:59
问题 In our rails app we use paperclip to save files to rackspace cloudfiles. We want to allow users to VIEW the files without needing to download them and use a program on their computer. We have found https://docs.google.com/viewer which looks good for the job We have the following method in the controller: def view att = Attachment.find(params[:id]) redirect_to "http://docs.google.com/viewer?url=#{CGI.escape(att.file.expiring_url((Time.now + 60.seconds)).gsub(/^http:/, "https:"))}" end This