paperclip

paperclip No handler found for “file.jpg” rails 4

时光毁灭记忆、已成空白 提交于 2019-12-11 02:35:18
问题 I'm having problem with setting up paperclip gem in one of me apps. I get No handler found for error message when i try to save uploaded file. Things that I've done migration: add_attachment :orders, :file model: has_attached_file :file validates_attachment_content_type :file, :content_type => /\Aimage\/.*\Z/ controller: def order_params params.require(:order).permit(:file) view: form_tag url, method: :post, html: {multipart: true} ... = file_field_tag 'order[file]', disabled: true, id: 'mtd

Paperclip gem spoofing error?

人走茶凉 提交于 2019-12-11 02:18:19
问题 I am using CentOS. I have paperclip gem newest version. I have read about spoofing and yet problem still persists! I even tried older version 3.5.2 and still getting error. I am doing this on remote server! Dont know if I have to restart apache or something? Heelp! I, [2014-04-09T18:41:45.251093 #5841] INFO -- : Command :: file -b --mime-type '/tmp/5b42e9da0503617fea7f216d7860262920140409-5841-k6wzm6' I, [2014-04-09T18:41:45.257581 #5841] INFO -- : [paperclip] Content Type Spoof: Filename

Paperclip S3 download remote images

最后都变了- 提交于 2019-12-11 01:48:01
问题 How I can download a remote image (http protocol, the url is in the image_remote_url attribute) and save it as an attachment to S3 via Paperclip ? class Product < ActiveRecord::Base require 'open-uri' attr_accessor :image_remote_url has_attached_file :photo, :storage => :s3, :s3_credentials => "#{RAILS_ROOT}/config/s3.yml", :path => ":class/:id/:style.:extension", :bucket => "my_bucket", :styles => { :icon => "32x32#", } def fetch_image # how should this method look ? end end How should the

Formtastic hint issue (unwanted object ID output) in ActiveAdmin

梦想的初衷 提交于 2019-12-11 01:35:34
问题 When I use formtastic DSL for ActiveAdmin edit form I get the following output: #< #< Class:0x00000006bd1f68>:0x00000006bd1018> <li class="file input optional" id="post_image_input"><label class="label" for="post_image">Image</label><input id="post_image" name="post[image]" type="file" /> Why does this starts from something like result of obj.inspect and how to remove this part? The code, causing this bug is here: form :html => { :multipart => true } do |f| f.inputs do #... f.input :image,

Paperclip in Production with Unicorn: uninitialized constant Paperclip (NameError)

假如想象 提交于 2019-12-11 01:27:25
问题 I added Paperclip to my app then tried to deploy to my VPS using capistrano. The deploy happens successfully, but when I try to access my app on the VPS, I get the Rails Error Page. There is no information in production.log , but unicorn.log has the following error: E, [2013-06-25T19:44:07.372060 #21995] ERROR -- : uninitialized constant Paperclip (NameError) /home/deployer/apps/arcsite/releases/20130625182331/config/initializers/paperclip.rb:1:in `<top (required)>' The initializer file is

Can't figure out what's causing my tests to fail

99封情书 提交于 2019-12-11 01:12:24
问题 I'm new to rails and I built an app without doing TDD but am now going back and trying to pass all the tests. I've passed most of them but there are a few left relating to the same issue that I can't figure out. The app functions correctly as well, I just can't pass these tests. The tests fail and provide this: 1) ProductsController POST create with valid params assigns a newly created product as @product Failure/Error: post :create, {:product => valid_attributes}, valid_session Paperclip:

Rails 3/ paperclip/ imagemagick - merging two images

匆匆过客 提交于 2019-12-11 00:32:24
问题 When a user uploads an image in my rails app imagemagick handles two transformations: has_attached_file :photo, :styles => { :listsize => "50x50#", :articlesize => "300x300" }, a listsize (square 50x50px) image is produced. Is it possible to at this point merge this image with a standard transparent png that would make the image look more like an icon? (I have the png image, I just want to know if it's possible to render another photo style that has this default transparent png placed over

Does paperclip require all 4 columns (_file_name, _content_type,etc)?

杀马特。学长 韩版系。学妹 提交于 2019-12-11 00:14:24
问题 I am wondering if Paperclip does require all four columns in database as: add_column :users, :avatar_file_name, :string add_column :users, :avatar_content_type, :string add_column :users, :avatar_file_size, :integer add_column :users, :avatar_updated_at, :datetime Can I just add the avatar_file_name? And not add the other 3 columns? It is because I wont to use paperclip instead of the filecolumn gem. And it uses only 1 column therefor I don´t want fill out all columns that paperclip support.

Paperclip & RMagick - 3-page thumbnail of PDF and renaming

若如初见. 提交于 2019-12-10 21:44:11
问题 I want to upload pdf file, and create (as a separate file) a thumbnail image with first 3 pages of the pdf aligned horizontally. I managed to do a Paperclip Processor with RMagick to generate that file, but the problem is: I want the seperate file (the one with style for thumbnail) have the right extension (ex. jpg) not original pdf. It would be great if I could still get the correct path by using the url method with style, for ex.: >> attachment.url => "/some/path/id/original/test.pdf" #

Rails 3 - RMagick doesn't find libfreetype.6.dylib using Paperclip

孤街醉人 提交于 2019-12-10 20:44:42
问题 I'm trying to use Paperclip to upload some image. It's work fine but if I want add some style with : :styles => { :small => "100x100" } It does not work anymore, I have this error message : myImage is not recognized by the 'identify' command. So, I've found some tips on the web and I've installed ImageMagick with Brew then I've added gem 'Rmagick' to my GemFile. And now when I restart my server, I get this message error : /usr/local/rvm/gems/ruby-1.9.3-p194@global/gems/rmagick-2.13.1/lib