carrierwave

Need to change the storage “directory” of files in an S3 Bucket (Carrierwave / Fog)

本小妞迷上赌 提交于 2019-12-07 08:27:15
问题 I am using Carrierwave with 3 separate models to upload photos to S3. I kept the default settings for the uploader, which was to store photos in a root S3 bucket. I then decided to store them in sub-directories according to model name like /avatars, items/, etc. based on the model they were uploaded from... Then, I noticed that files of the same name were being overwritten and when I deleted a model record, the photo wasn't being deleted. I've since changed the store_dir from an uploader

Using ng-file-upload with Rails carrierwave gem to upload multiple files

匆匆过客 提交于 2019-12-07 01:46:55
问题 I'm trying to combine ng-file-upload and carrierwave to upload multiple files, but the controller on server side receives only one file (the last item of the selected files). Client side (reference) html <button type="file" ng-model="files" ngf-select ngf-multiple="true">Upload</button> js var upload = function (files, content) { return Upload.upload({ url: 'MY_CONTROLLER_URL', file: files, // files is an array of multiple files fields: { 'MY_KEY': 'MY_CONTENT' } }).progress(function (evt) {

Carrierwave + s3 + fog (Excon::Errors::SocketError)

帅比萌擦擦* 提交于 2019-12-07 01:04:28
问题 I'm currently getting the following error: Excon::Errors::SocketError - Broken pipe (Errno::EPIPE) when uploading images bigger than about 150kb. Images under 150kb work correctly. Research indicates that others have also experienced this problem but I'm yet to find a solution. Error message Excon::Errors::SocketError at /photos Message Broken pipe (Errno::EPIPE) File /Users/thmsmxwll/.rvm/rubies/ruby-1.9.3-p194/lib/ruby/1.9.1/openssl/buffering.rb Line 375 image_uploader.rb class

Multi file upload with rails_admin (Carrierwave, Paperclip, Dragonfly)

北城以北 提交于 2019-12-06 20:40:29
I'm looking for a quick solution for multi file upload with rails_admin. Any ideas or solutions out there? The approach I'd take here is to develop a custom action which would include it's own view and controller processing. You can generate a rails_admin plugin with the directions at the top of the page here . And here are some examples of custom actions I've built out: Import Print to PDF The import plugin has a supporting blog article here . This is the file you want to look at where you add your upload behavior inside the :controller instance option. 来源: https://stackoverflow.com/questions

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

亡梦爱人 提交于 2019-12-06 20:06:13
问题 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:

How to delete the original files and keep only the versions using CarrierWave?

心已入冬 提交于 2019-12-06 17:01:33
I'm trying this but without luck. class FileUploader < CarrierWave::Uploader::Base after :cache, :unlink_original def unlink_original(file) file.delete end . . end Kleber S. Figured it out. There was a typo in the docs. Fixed it with the following. class FileUploader < CarrierWave::Uploader::Base after :store, :unlink_original def unlink_original(file) File.delete if version_name.blank? end . . end 来源: https://stackoverflow.com/questions/9557911/how-to-delete-the-original-files-and-keep-only-the-versions-using-carrierwave

Rails convert Paperclip directory structure to Carrierwave

限于喜欢 提交于 2019-12-06 15:12:28
I was using the Paperclip gem: https://github.com/thoughtbot/paperclip I'm now using Carrierwave: https://github.com/carrierwaveuploader/carrierwave My production website is currently using Paperclip. I'm going to be updating the production website to use Carrierwave. The folder structure for uploads in Paperclip differs from Carrierwave. I'm also using Amazon S3 to store uploads. I'm wondering if there's a way to convert my production files uploaded with Paperclip to Carrierwave. For example, with Paperclip in production I currently have something like the following for resumes: bucket_name

With `CarrierWave::MimeTypes` deprecated, how should uploaders handle/overwrite generic content types?

江枫思渺然 提交于 2019-12-06 12:47:56
问题 Problem CarrierWave::MimeTypes , which added the set_content_type method to an uploader is deprecated. Among other things, this method would attempt to detect the content type if the given one was generic (either application/octet-stream or binary/octet-stream ). The deprecation message for CarrierWave::MimeTypes says: get the content_type from the SanitizedFile object directly However this class always returns the existing content type if it is defined whether it is generic or not. See the

Ruby on Rails - Carrierwave get the image dimension width and height

这一生的挚爱 提交于 2019-12-06 12:01:09
问题 I need to know the width and height of the current instance of carrierwave For example: image_tag image.photo_url,:width => image.photo.width, :height => image.photo.height But the problem is that image.photo.width and image.photo.height are not working. Any ideas ? 回答1: You have to install ImageMagick, RMagick or MiniMagick. Then you open the file (image) before you can find out its height. Example: https://github.com/jnicklas/carrierwave#conditional-versions (see the is_landscape? method),

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

混江龙づ霸主 提交于 2019-12-06 10:06:25
问题 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