paperclip

Save files using paperclip via API

我是研究僧i 提交于 2019-12-09 06:07:01
问题 I'm using paperclip to manage uploads, backed onto S3 via Fog. It works well. I'm trying to take attachments out of emails and save them via paperclip (using the same model etc). Email are parsed by an external service and POSTed to my app, including the attachments. I'm receiving the file itself fine, but I can't work out how to save it using paperclip. The post gives me an object of type ActionDispatch::Http::UploadedFile . I took a look at the below, but this involves creating a new File

Rails and Paperclip… don't save the original image, just the styles?

陌路散爱 提交于 2019-12-09 03:36:29
问题 In paperclip when you save an image with lots of style and sizes it also saves the original. But in my app it's not necessary to save the original, just the style will do, what I was wondering was how do you not save the original. Just store it in memory or in a temporary area and then not save it once the style have been generated. Ideally it would not save original at all. I guess one solution would be to save the original, process the style and delete afterwards, however I'm trying to save

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

喜你入骨 提交于 2019-12-09 02:25:56
问题 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. 回答1: Just set it like this: Paperclip::Attachment.default_options[:url] = ':s3_domain_url' Or like this: Paperclip::Attachment.default_options.merge

How to use paperclip with rails and how does it work in deployment?

笑着哭i 提交于 2019-12-08 20:57:30
I've done 2 Rails apps involving image uploads with paperclip. The first one I did a while ago worked fine locally but I had issues when I deployed to Heroku; I realized I needed to use AWS to enable image uploads. I did that project a while ago. I recently started another project and tried to incorporate similar functionality. Before I enabled AWS with paperclip when I tried to deploy, I just wanted to test what would happen if I tried to upload an image. To my surprise, it worked without AWS! I was hoping to understand why it didn't work the first time and why it does work now. How does

paperclip 2.7.0 on ruby 1.8.7

 ̄綄美尐妖づ 提交于 2019-12-08 20:54:37
I have a very old rails app (rails 2.3.10 and ruby 1.8.7) and we want to move it on another server. I can reinstall all gems with same version except for paperclip 2.7. when i tried to install it i receive an error on activesupport, that it seems it require ruby 1.9.3. According with paperclip doc this shouldn't happens, some one of you can help me? i tried with all gems except paperclip, with no gems, and installing an old version of activesupport. Below you can find my tests. app@new-server:/home/app/current# sudo gem list *** LOCAL GEMS *** app@new-server:/home/app/current# sudo gem install

Rails 4: Paperclip and rails_admin “undefined method `attachment_definitions' error”

强颜欢笑 提交于 2019-12-08 19:30:22
问题 I am using rails_admin and paperclip but installing rails_admin with a model having paperclip attributes has_attached_file throws an error undefined method `attachment_definitions' I am using Rails 4 and rails_admin at master git branch and protected attributes gem. 回答1: I am on rails 3 still but ran into the same issue. I am fairly certain its an issue with the latest paperclip and rails_admin. I backed paperclip down to paperclip (3.4.2) and everything works. Another thing of note I am

How to know if an image has been uploaded or not? - Paperclip

僤鯓⒐⒋嵵緔 提交于 2019-12-08 19:23:04
问题 do you know if is there a method to know if the image has been uploaded? I mean, i have a Foo_Class, and this class can have an attached image, but its presence is not necessary. Is there a way to know if a particular instance of that class have the image or not? Thanks! 回答1: When you added Paperclip to your model you added paperclip specific rows, mine are cover_file_name cover_content_type cover_file_size cover_updated_at Then I check whether it is nil or not Foo_Class.cover_file_name.nil?

Specifying missing.png in Paperclip

风流意气都作罢 提交于 2019-12-08 18:20:42
问题 I am using Paperclip to handle profile photo uploads in my app. They upload well and resize to the specifications in my model. However, if a User's profile :photo is nil, no matter what I try I can't change the default. Here's the code I want to use: <% if @profile.photo.nil? %> <%= image_tag "public/images/example.jpg", :html => { :id => "noUserProfile" } %> <% else %> <%= image_tag @profile.photo.url(:normal) %> <% end %> I've tried "../public/images/example.jpg" and that doesn't work

Rails image upload security

拟墨画扇 提交于 2019-12-08 18:14:26
Currently, I adopt Carrierwave for users to images. However, I hardly find a solution for image security, i.e. how to set image authorisation for the uploaded images to only let certain user in the same group to view? After digging Facebook's implementation, I observe that they inject these params (oh,oe, __gda_) to the image url ?oh=924eb34394&oe=55E07&__gda__=1436393492fc8bf91e1aec5 Is there any similar implementation for carrierwave or paperclip ? Thanks I worked quite a bit with this (only with Paperclip). There is one solution that is okay, but it takes a lot of processing. If you only

Rails Heroku server paperclip Amazon S3 - AWS::S3::Errors::RequestTimeout

我们两清 提交于 2019-12-08 16:24:02
问题 When I am saving my konkurrencer model with a attached image I get a error on Heroku, but not on my local server. . My heroku log: ←[36m2012-04-01T17:45:37+00:00 app[web.1]:←[0m Started POST "/admin/konkurrencer s" for MYIP at 2012-04-01 10:45:37 -0700 ←[33m2012-04-01T17:46:01+00:00 heroku[router]:←[0m POST www.konkurrencerher.dk/a dmin/konkurrencers dyno=web.1 queue=0 wait=0ms service=24565ms status=500 bytes= 728 ←[32m2012-04-01T17:46:01+00:00 heroku[nginx]:←[0m MYIP - - [01/Apr/201 2:17:46