carrierwave

Carrierwave: convert an uploaded PNG to JPG by replacing the original version

早过忘川 提交于 2020-03-25 18:47:29
问题 I have the following model: class ScreenshotUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick storage :file convert :jpg version :thumb do process resize_to_fill: [50, 50] end def extension_whitelist %w(jpg jpeg gif png) end version :print do process border: ['black'] process quality: 80 end end The upload of the image happens via pasting an image from the clipboard via https://github.com/layerssss/paste.js and is saved as a base64 encoded string into a <textarea> , then

undefined method `url' for “#<ActionDispatch::Http::UploadedFile:0x007f8b6134d610>”:String

岁酱吖の 提交于 2020-02-22 08:09:03
问题 I am using Carrierwave to upload picture, after uploaded, I got the error when go to show page: undefined method `url' for "#ActionDispatch::Http::UploadedFile:0x007f8b6134d610>":String <%= image_tag @product.picture.url if @product.picture? %> Here is my code: _form.html.erb <div class="picture"> <%= f.file_field :picture %> </div> product.rb class Product < ApplicationRecord has_many :reviews, dependent: :destroy mount_uploader :picture, PictureUploader end show.html.erb <p id="notice"><%=

undefined method `url' for “#<ActionDispatch::Http::UploadedFile:0x007f8b6134d610>”:String

风流意气都作罢 提交于 2020-02-22 08:06:42
问题 I am using Carrierwave to upload picture, after uploaded, I got the error when go to show page: undefined method `url' for "#ActionDispatch::Http::UploadedFile:0x007f8b6134d610>":String <%= image_tag @product.picture.url if @product.picture? %> Here is my code: _form.html.erb <div class="picture"> <%= f.file_field :picture %> </div> product.rb class Product < ApplicationRecord has_many :reviews, dependent: :destroy mount_uploader :picture, PictureUploader end show.html.erb <p id="notice"><%=

CarrierWave Backgrounder process leaves denied access to s3 image

拜拜、爱过 提交于 2020-02-08 09:15:47
问题 My current Sidekiq setup with the following is processing the image, but nothing is being done in the background. The page takes 10 seconds to load and then the new image is shown on the redirected page with the following path. https://d9vwx0ll7rhpx.cloudfront.net/development/photo/image/product_thumb/product_thumb_0046d4ca-ca8d-4c02-b8cd-da0255c5736e.jpg I would like for this process to be done in the background. def create @photo = Photo.new(photo_params) if @photo.save UploadsWorker

CarrierWave Backgrounder process leaves denied access to s3 image

旧时模样 提交于 2020-02-08 09:15:09
问题 My current Sidekiq setup with the following is processing the image, but nothing is being done in the background. The page takes 10 seconds to load and then the new image is shown on the redirected page with the following path. https://d9vwx0ll7rhpx.cloudfront.net/development/photo/image/product_thumb/product_thumb_0046d4ca-ca8d-4c02-b8cd-da0255c5736e.jpg I would like for this process to be done in the background. def create @photo = Photo.new(photo_params) if @photo.save UploadsWorker

CarrierWave Backgrounder process leaves denied access to s3 image

旧城冷巷雨未停 提交于 2020-02-08 09:14:22
问题 My current Sidekiq setup with the following is processing the image, but nothing is being done in the background. The page takes 10 seconds to load and then the new image is shown on the redirected page with the following path. https://d9vwx0ll7rhpx.cloudfront.net/development/photo/image/product_thumb/product_thumb_0046d4ca-ca8d-4c02-b8cd-da0255c5736e.jpg I would like for this process to be done in the background. def create @photo = Photo.new(photo_params) if @photo.save UploadsWorker

Rails carrierwave S3 get url with Content-Disposition header

戏子无情 提交于 2020-02-04 01:32:31
问题 We are using carrierwave + aws S3 to upload file, and we need provide a download function. For solution 1, we use: = link_to "Download", file.doc.url, download: file.original_name And it does not work under IE8, click the link will open this file(image). According to This, I should add Content-Disposition header, Then I check aws S3 document, Found I need add response-content-disposition to file.doc.url , Is there any way I can do this in carrierwave, or I could use other ways? Thanks for

Need to implement #cache! if you want to use Cloudinary::CarrierWave::Storage as a cache storage

旧巷老猫 提交于 2020-01-30 05:01:09
问题 I am getting this error when trying to upload a picture "Need to implement #cache! if you want to use Cloudinary::CarrierWave::Storage as a cache storage." It highlights this part of code in my controller: def update @company.update(company_params) redirect_to company_path(@company) end I am using Carrierwave to upload photo to cloudinary. I have a cloudinary.yml file with my configuration as well as a cloudinary.rb in my initializers. identitylogo_uploader.rb class IdentitylogoUploader <

Setup for an uploader (carrierwave)

天大地大妈咪最大 提交于 2020-01-25 11:00:06
问题 I have an image uploader in place following a tutorial using the gems carrierwave and fog. Now I would like to add an additional uploader but am struggling. I have generated the uploader ( rails generate uploader name ). In the model file I have mounted the uploader to the right column ( mount_uploader :column_name, nameUploader ). In the uploader itself I have set def extension_white_list and store_dir . Also I included (since in the tutorial I did the same): if Rails.env.production? storage

Turbolinks with carrierwave images as CSS background-image

馋奶兔 提交于 2020-01-22 13:56:19
问题 I've been using turbolinks along this year but lately I'm getting this annoying bug. Images uploaded via carrierwave are loaded in the site with absolute URL's in the first request, but when you start browsing in the site via turbolinks, all carrierwave images change to relative paths. <%= image_tag "image.jpg %> elements work ok, but the images are loaded as CSS background-image, they don't appear. This apparently happens only on chrome (I have Versión 31.0.1650.57 m). I made a trace via