paperclip

Install ImageMagick for paperclip gem in windows

萝らか妹 提交于 2019-12-01 11:11:34
I followed this guide to use paperclip http://railscasts.com/episodes/134-paperclip?language=en&view=asciicast it is all ok but note that to enable resizing you’ll need to have ImageMagick installed on your server. So how should i install ImageMagick ?? i have WINDOWS 8 and on the site http://www.imagemagick.org/ download does not work!!!! It certainly works - you need to make sure of 2 things: You install the correct static version for your OS (32-bit vs 64-bit). The 32-bit (x86) will work regardless, the 64-bit (x64) will only work on a 64-bit system. And you need to download the static

Rails Paperclip S3 ArgumentError (missing required :bucket option):

旧巷老猫 提交于 2019-12-01 09:30:15
I've been stuck on this for ages now and can't figure out what's wrong. There are a lot of people that seem to have this same problem, but I can't actually find any answers that actually work. production.rb config.paperclip_defaults = { :storage => :s3, :s3_credentials => { :bucket => ENV['my bucket name is here'], :access_key_id => ENV['my key is here'], :secret_access_key => ENV['my secret key is here'] } } game.rb require 'aws/s3' class Game < ActiveRecord::Base attr_accessible :swf, :swf_file_name, :name, :description, :category, :age_group, :dimension_x, :dimension_y, :image, :image_file

Paperclip + RSpec: content_type validation

淺唱寂寞╮ 提交于 2019-12-01 09:27:46
问题 I am using Paperclip in my Rails application for attaching images . I declared validation for content_type in my model as validates_attachment :image, :content_type => { :content_type => ["image/jpg", "image/gif", "image/png"] } I have two examples, one with a valid image and other with an invalid image For an invalid image, i just renamed a .txt file to a .png it "Image is valid" do image = File.new("#{Rails.root}/spec/support/right.png") expect(FactoryGirl.build(:pin, image: image)).to be

Rails Paperclip S3 ArgumentError (missing required :bucket option):

余生长醉 提交于 2019-12-01 07:32:20
问题 I've been stuck on this for ages now and can't figure out what's wrong. There are a lot of people that seem to have this same problem, but I can't actually find any answers that actually work. production.rb config.paperclip_defaults = { :storage => :s3, :s3_credentials => { :bucket => ENV['my bucket name is here'], :access_key_id => ENV['my key is here'], :secret_access_key => ENV['my secret key is here'] } } game.rb require 'aws/s3' class Game < ActiveRecord::Base attr_accessible :swf, :swf

Weird paperclip error message

只愿长相守 提交于 2019-12-01 07:21:14
问题 I have a Rails 3 app using Paperclip 2.3.8. I have the following specified in my model: validates_attachment_content_type :file, :content_type => ['image/jpeg', 'image/png', 'image/gif', 'image/pjpeg', 'image/x-png'], :message => 'Not a valid image file.' But, when I test a bogus upload, instead of "Not a valid image file." I get this weird error message: /var/folders/cs/cs-jiL3ZH1WOkgLrcqa5Ck+++TI/-Tmp-/stream20110404-43533-vm7eza.pdf is not recognized by the 'identify' command. Any ideas

Paperclip error - NotIdentifiedByImageMagickError

随声附和 提交于 2019-12-01 05:23:54
I'm trying to upload images to aws s3 with paperclip but I get this error Command :: file -b --mime '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1u773ft.jpg' Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1rep3kt.jpg[0]' 2>/dev/null [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError: Paperclip::Errors::NotIdentifiedByImageMagickError> Command :: identify -format '%wx%h,%[exif:orientation

Rails: Preventing Duplicate Photo Uploads with Paperclip?

牧云@^-^@ 提交于 2019-12-01 03:20:48
Is there anyway to throw a validation error if a user tries to upload the same photo twice to a Rails app using Paperclip? Paperclip doesn't seem to offer this functionality... I'm using Rails 2.3.5 and Paperclip (obviously). SOLUTION: (or one of them, at least) Using Beerlington's suggestion, I decided to go with an MD5 Checksum comparison: class Photo < ActiveRecord::Base #... has_attached_file :image #, ... before_validation_on_create :generate_md5_checksum validate :unique_photo #... def generate_md5_checksum self.md5_checksum = Digest::MD5.hexdigest(image.to_file.read) end def unique

Setting up bucket's name placed domain-style (bucket.s3.amazonaws.com) with Rails and Paperclip

删除回忆录丶 提交于 2019-12-01 02:35:29
Paperclip doc about url options: You can choose to have the bucket's name placed domain-style (bucket.s3.amazonaws.com) or path-style (s3.amazonaws.com/bucket). How would look like the setup to actually have bucket's name placed domain-style? I can't force paperclip to generate urls like bucket.s3.amazonaws.com instead of s3.amazonaws.com/bucket. Just set it like this: Paperclip::Attachment.default_options[:url] = ':s3_domain_url' Or like this: Paperclip::Attachment.default_options.merge!( :url => ':s3_domain_url' ) Add :url and :path to the Paperclip default options in your application.rb or

Paperclip error - NotIdentifiedByImageMagickError

橙三吉。 提交于 2019-12-01 01:58:57
问题 I'm trying to upload images to aws s3 with paperclip but I get this error Command :: file -b --mime '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1u773ft.jpg' Command :: identify -format '%wx%h,%[exif:orientation]' '/var/folders/d_/k4_ps9hj5fj_3df5t210vjym0000gn/T/2611a2396a4af6938e5c5867c8bb409f20140515-7787-1rep3kt.jpg[0]' 2>/dev/null [paperclip] An error was received while processing: #<Paperclip::Errors::NotIdentifiedByImageMagickError:

Paperclip Video Upload

假如想象 提交于 2019-11-30 22:41:07
I'm trying to enable video upload in my post. Can't get it to display the video. The video gets uploaded, I can confirm that while i manage to right click on the video area and download it. The problem is how to view it correctly. Migration: class AddAttachmentVideoToPosts < ActiveRecord::Migration def self.up change_table :posts do |t| t.attachment :video end end def self.down drop_attached_file :posts, :video end end def change create_table :videos do |t| t.string :video_file_name t.string :video_content_type t.integer :video_file_size t.datetime :video_updated_at t.timestamps end end Post