paperclip

Paperclip Video Upload

跟風遠走 提交于 2019-12-03 21:23:25
问题 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

Heroku ffmpeg buildpacks for video uploads

人盡茶涼 提交于 2019-12-03 21:00:49
Is there a proper way to get heroku ffmpeg installed and running so that my users can upload videos in my rails app? Tried the Heroku references on the topic which led to my app running the heroku error check logs page... I know there has to be some installation I have to pass but don't seems to find anything on it - Please help with links or ideas :) users can upload videos We've had it working on Heroku before; we used paperclip-ffmpeg (which is now paperclip-av-transcoder ) with the actual Paperclip gem. Whilst I can't provide any information about the buildpacks, I can share how we were

Seed images in heroku with paperclip

六眼飞鱼酱① 提交于 2019-12-03 17:23:20
When I run heroku run rake db:seed I get Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/image20130219-2-1gk1yip.png[0]' Command :: composite -gravity Center /app/public/media/watermark.png "/tmp/image20130219-2-1gk1yip.png[0]" -resize "1x1<" "/tmp/image20130219-2-1gk1yip.png20130219-2-1ng5f6c[0]" Command :: file -b --mime '/tmp/image20130219-2-1gk1yip.png20130219-2-1ng5f6c' Command :: identify -format '%wx%h,%[exif:orientation]' '/tmp/image20130219-2-1gk1yip20130219-2-t3caqg.png20130219-2-1ng5f6c[0]' Command :: convert "/tmp/image20130219-2-1gk1yip20130219-2-t3caqg.png20130219-2

How can I use Rspec to test that a model using Paperclip is validating the size of an uploaded file?

女生的网名这么多〃 提交于 2019-12-03 17:11:20
The model: class Attachment < ActiveRecord::Base belongs_to :narrative attr_accessible :description, :user_id, :narrative_id has_attached_file :file validates_presence_of :user_id validates_presence_of :narrative_id validates_attachment :file, :presence => true, :size => {:less_than => 20.megabytes} end The test which doesn't work: describe Attachment do it { should validate_presence_of :file } it { should validate_size_of :file } # validate_size_of does not exist end I would like to avoid dumping a 20 MB file into the repo just to test this. Is there a way similar to the one I tried above

Generate Thumbnail From pdf in rails paperclip

跟風遠走 提交于 2019-12-03 16:46:07
问题 How can I generate the first page of a pdf as a thumbnail in paperclip? I tried a lot but it's not working has_attached_file :book_url, :styles => { :thumb => "100x100#", :small => "150x150>", :medium => "200x200" } This is giving the name of the pdf as a link but it's not giving the first page of the pdf <%= link_to 'My PDF', @book.book_url.url %> 回答1: Tadas' answer is right, but for those who need more context, you can do something like this: The model below only creates thumbnails for

ROR- Step by step multiple images using Paperclip

馋奶兔 提交于 2019-12-03 16:38:05
I have used the "tutorial" on here but for some reason it didn't work. Can anyone give me a step-by-step guide for setting up a multiple image form (upload) with other form elements ... Also another tutorial (a good one) may be provided. I only want to use the paperclip plugin. @Gordon Isnor: I have uploaded my current (noob) project with some functionality (login, register) but it's not even fine tuned a little. I'm only trying to get the multiple images working, all code of the "multiple" images is deleted in this source. So it's clean and running. (don't notice the current login for now ;-)

Paperclip and Amazon S3 Issue

和自甴很熟 提交于 2019-12-03 16:15:40
I have a rails app running on Heroku. I am using paperclip for some simple image uploads for user avatars and some other things, I have S3 set as my backend and everything seems to be working fine except when trying to push to S3 I get the following error: The AWS Access Key Id you provided does not exist in our records. Thinking I mis-pasted my access key and secret key, I tried again, still no luck. Thinking maybe it was just a buggy key I deactivated it and generated a new one. Still no luck. Now for both keys I have used the S3 browser app on OS X and have been able to connect to each and

Securely Display an Image Uploaded with paperclip gem

被刻印的时光 ゝ 提交于 2019-12-03 15:46:24
By Default: the paperclip gem stores all attachments within the public directory. I did not want to store the attachments within the public directory for security reasons, so I saved them within an uploads directory at the root of the app: class Post < ActiveRecord::Base belongs_to :user has_attached_file :some_image, path: ":rails_root/uploads/:attachment/:id/:style/:filename" do_not_validate_attachment_file_type :some_image end I did not specify the url option because I do not want a url for each image attachment. If a url is specified: then ANYONE with that url can access the image. This is

File download using Paperclip

妖精的绣舞 提交于 2019-12-03 15:43:58
问题 I am using Rails to make a small file upload app. For file attachment I am using the wonderful Paperclip but I can't work out how to do downloads. How would I create a link in my show view, that is passed the file id, for instance that would allow the user to download a file on my server? 回答1: If the file uploaded is attached to a model, e.g. as an attribute called avatar , then you can create a link like: <%= link_to "Download", model.avatar.url(:original, false) %> Replace avatar with the

Using Rails with Paperclip and SWFUpload

不问归期 提交于 2019-12-03 14:12:22
I have a basic rails application test with a user model that has a photo field handled with paperclip. I created the views to be able to create/edit an user and the photo uploading is working nicely. <h1>Editing user</h1> <% form_for :user, @user, :url => user_path(@user), :html => { :method => "put", :multipart => true } do |f| %> <%= f.error_messages %> <p> <%= f.label :first_name %><br /> <%= f.text_field :first_name %> </p> <p> <%= f.label :last_name %><br /> <%= f.text_field :last_name %> </p> <p> <%= f.label :file %><br /> <%= f.file_field :file %> </p> <p> <%= f.label :photo %><br /> <%