carrierwave

Carrierwave Programatic Upload

生来就可爱ヽ(ⅴ<●) 提交于 2019-12-05 05:47:54
问题 Right now in my rails app I'm using Carrierwave to upload files to Amazon S3. I'm using a file selector and a form to select and submit the file, this works well. However, I'm now trying to make posts from an iPhone app and am receiving the contents of the file. I'd like to create a file using this data and then upload it using Carrierwave so that I can get the correct path back. May file model consists of: path file_name id user_id where path is the Amazon S3 url. I'd like to do something

How to check if image version exists on S3 with Carrierwave and Fog?

会有一股神秘感。 提交于 2019-12-05 03:42:43
I'm uploading my images with Carrierwave and Fog to S3. On the upload I also create a thumbnail version of the image: version :thumb do process :resize_to_limit => [90, 80], if: :is_resizable? end Now I need a method to check if thumbnail version exists. The Documentation lists the exists? method. This actually works, if I want to check the existence of the original version: asset.file.exists? # => true But when I use the "thumb" version like this: asset.url(:thumb).file.exists? it get: undefined method 'exists?' for #<String:0x007fcd9f9d9620> : Use this: asset.thumb.file.exists? instead of:

Is it possible to have a dynamic storage path with carrierwave?

陌路散爱 提交于 2019-12-05 02:50:38
问题 I am starting with carrierwave for file uploads and have been quite happy with it so far. My files are stored on amazon s3 which was fairly easy and it works reliably. Now I have a model named pictures and an uploader name MainUploader . I need a special dynamic path to save those files to when uploaded. I am also using devise and I have the current_user I can access from my views and controller but not from the carrierwave uploader. I need the path of the file to be something like uploads/#

Carrierwave: Scale image if the size is larger than (conditionally create versions)

感情迁移 提交于 2019-12-05 02:13:34
问题 Is possible with carrierwave create a version (for example thumb) only if the image is larger than the size of the version?? Example: version :thumb, :if => :is_thumbnable? do process :resize_to_fit => [32,nil] end protected def is_thumbnable?(file) image ||= MiniMagick::Image.open(file.path) if image.nil? if image['width'] >= 32 || image['height'] >= 32 true else false end else false end end 回答1: I defined method in which if image exceed given width then manipulate it to your size the 32

Using CarrierWave with Amazon Elastic Transcoder in a Rails app

让人想犯罪 __ 提交于 2019-12-05 02:11:36
问题 I asked two additional questions before this on Stack Overflow, but got very little help and I thought I would ask an open question for posterity. I have spent time parsing the AWS-SDK API docs and found very little direct answers to my needs. I have also posted on the AWS forums and haven't been able to get a good response there. A simple, comprehensive, step-by-step solution seems impossible to find. What I have completed: Uploading with CarrierWave direct to s3. I followed Railscast #383

How do you generate retina (iPad) friendly (progressive or interlaced) jpeg images with CarrierWave?

依然范特西╮ 提交于 2019-12-05 01:09:43
问题 There are numerous reports that Mobile Safari downsamples very large JPEG images, making it difficult to put out retina-friendly resolutions for the new iPad. The solution seems to be encoding JPEGs as progressive/interlaced files. Hence, I'm curious how I might use the CarrierWave plugin, and RMagick by extension, to generate this type of file. Thanks! 回答1: You can use MiniMagick: manipulate! do |img| img.strip img.combine_options do |c| c.quality "90" c.depth "8" c.interlace "plane" end img

Download a Carrierwave upload from S3

自古美人都是妖i 提交于 2019-12-05 00:33:17
问题 I'd like to download an image that was uploaded to S3 using carrierwave. The image is on the Card model, mounted as an uploader. I saw this answer, but had trouble getting that solution to work. My code is: #download image from S3 uploader = card.image #image is the mounted uploader uploader.retrieve_from_store!(File.basename(card.image.url)) uploader.cache_stored_file! that last line throws: "... caused an exception (undefined method `body' for nil:NilClass)..." My carrierwave config looks

Carrierwave and amazon s3

醉酒当歌 提交于 2019-12-04 20:36:36
I am using the carrierwave gem to manage file uploads in my rails 3 app, however, I am not able to connect to my amazon s3 bucket. I have followed the instructions on the wiki yet they are not quite detailed enough, for example where do I store my s3 credentials? Put something like this in an initializer. CarrierWave.configure do |config| config.storage = :fog config.fog_directory = 'your_bucket' config.fog_credentials = { :provider => 'AWS', :aws_access_key_id => 'your_access_key' :aws_secret_access_key => 'your_secret_key', :region => 'your_region' } end You can store your credentials right

Papertrail and Carrierwave

余生长醉 提交于 2019-12-04 18:49:06
问题 I have a model that use both: Carrierwave for store photos, and PaperTrail for versioning. I also configured Carrierwave for store diferent files when updates (That's because I want to version the photos) with config.remove_previously_stored_files_after_update = false The problem is that PaperTrail try to store the whole Ruby Object from the photo (CarrierWave Uploader) instead of simply a string (that would be its url) (version table, column object) --- first_name: Foo last_name: Bar photo:

carrierwave doesn't render, path exists but image doesn't show up

空扰寡人 提交于 2019-12-04 17:47:07
ive been trying to render a picture from carrierwave. i believe it is uploaded correctly because when i view the page source, i see <img alt="Photo_44" src="/uploads/user/image/59/Photo_44.jpg" /> however by clicking on that src url, i get No route matches [GET] "/uploads/user/image/59/Photo_44.jpg" im using the default settings for carrierwave. the image does correctly get uploaded to my image column in my users table and locally, the path sasha/Desktop/rails_projects/myproject/public/uploads/user/image/59/Photo_44.jpg exists as well. however it won't display correctly. ive been following the