paperclip

Heading into 2013, should I go with Dragonfly or Paperclip or Carrierwave? [closed]

為{幸葍}努か 提交于 2019-12-21 03:32:39
问题 As it currently stands, this question is not a good fit for our Q&A format. We expect answers to be supported by facts, references, or expertise, but this question will likely solicit debate, arguments, polling, or extended discussion. If you feel that this question can be improved and possibly reopened, visit the help center for guidance. Closed 6 years ago . I am just another average joe hoping to jump onto the social network bandwagon. I'd like to know which photo uploading/resizing gem I

How can I restrict Paperclip to only accept images?

烈酒焚心 提交于 2019-12-20 18:31:06
问题 How can I restrict Paperclip to only accept images? I'm using Amazon S3 for storage if that's relevant. Thanks for reading. 回答1: Paperclip has validation methods like validates_attachment_presence , validates_attachment_content_type , and validates_attachment_size . So all you need to do is pass mime types of images you'd like to have as attachments: validates_attachment_content_type 'image/png', 'image/jpg' 回答2: From https://makandracards.com/makandra/606-only-allow-pictures-as-paperclip

Rails3 and Paperclip

本秂侑毒 提交于 2019-12-20 15:08:10
问题 I have migrated my application from rails 2.3 to rails3 and i have a problem with paperclip. I saw there was a branch for rails3 on paperclip git. So I added "gem 'paperclip', :git => 'git://github.com/thoughtbot/paperclip.git', :branch => 'rails3'" into the Gemfile and launch the command bundle install. Once paperclip installed, the upload worked fine but not the styles. I saw a hack to fix it. # in lib/paperclip/attachment.rb at line 293 def callback which #:nodoc: # replace this line... #

conditional convert options paperclip

人盡茶涼 提交于 2019-12-20 14:06:26
问题 After some research I was able to add styles based on my image_class column. Model.rb has_attached_file :image, :styles => lambda { |attachment| attachment.instance.decide_styles } def decide_styles styles = {} case self.image_class when "poster" styles[:thumb] = ["30x45!", :jpg] styles[:standard] = ["185x278!", :jpg] styles[:expanded] = ["372x559!", :jpg] styles[:big] = ["600x900!", :jpg] when "cover" styles[:thumb] = ["30x45!", :jpg] styles[:standard] = ["300x1200!", :jpg] end styles end

How to thumbnail a multi-page pdf with paperclip

我的未来我决定 提交于 2019-12-20 10:53:10
问题 I'd like to have Paperclip create 2 thumbnails for each page of a multipage PDF file that is uploaded. I'm running Paperclip 2.3.1.1 and using this in my Asset model: has_attached_file :asset, :styles => { :medium => "800x600>", :thumb => "100x100>" } So, when I upload a 3 page pdf file, I was hoping this would create 2 thumbs per page (one at 800x600 and a smaller image at 100x100). Instead, I get a 3 folders created (thumb, medium, original) - the original folder contains the origianl pdf

everytime push to heroku, images is not showed ,paperclip

一世执手 提交于 2019-12-20 09:45:29
问题 here was my situation. I was using paperclip to let user upload images. It did well and everything was okay. Then,I pushed it to heroku. For the momment, I can see all my images that was just upload by users. However, everytime make a new commit and push to heroku again, all of my previous images gone. It's seems like dont have the file anymore,cant load it. So,here what i thought: Is it every time i pushed to the heroku server, the images file that was in local was uploaded to the heroku

Resize existing images to new style in paperclip & RMagick

我与影子孤独终老i 提交于 2019-12-20 08:01:46
问题 I've been using paperclip to upload and auto-resize photos in my Rails app, and I love it. Only problem is about every other month my crazy manager decides he wants a new size to display the photos in. So I add a new style in my Photo model and all is good for new photos, but the pre-existing photos are now a problem. Now that I'm starting to have more than a few photos to deal with I need a programmatic way to resize existing photos. Perhaps there is some paperclip trick for such a thing? I

Save a picture in S3 from a temporary URL

人盡茶涼 提交于 2019-12-20 07:10:07
问题 I am developing a website on ruby on rails where users can upload pictures thanks to paperclip , it is stored in amazon S3 . After, they can modify pictures thanks to aviary . But when i want to save the new pictures, aviary just gave me an temporary URL where i can get my modified picture. Does paperclip can do it ? I don't think it can save an picture from an URL and store it to S3 ? I've searched for a week now, and i don't know the best way to do it. I've read about filepicker , but the

Can we find out when a Paperclip download is complete?

旧城冷巷雨未停 提交于 2019-12-20 05:53:35
问题 I have an application where I need to know when a user's Rails/Paperclip file download is complete . My app is set up to interact with Amazon S3 and I need to run a javascript function when the user has received the completed file. How can I do this? 回答1: Tracking weather or not the download completes is hard, especially in Javascript. There are a few blurred lines in your question which makes me think its not possible. First, send_file passes a special header to tell the webserver telling it

Uploadify + Paperclip + Rails nested association before_save

亡梦爱人 提交于 2019-12-20 03:32:14
问题 I need to create a model application form where models can fill it and add pictures to it. I'm following this example with Uploadify, Paperclip and Rails 3 approach. https://github.com/websymphony/Rails3-Paperclip-Uploadify To the pictures, i have an polymorphic Attachment model and i would like to attach those ajax uploaded attachments to the yet unsaved model form and there's is where the tricky part cames. Users are not logged, so there's no "model_id" until is saved. Since i'm showing the