carrierwave

RMagick complaining about libMagickCore.5.dylib not found in OSX

浪子不回头ぞ 提交于 2020-01-22 13:23:53
问题 after running brew upgrade imagemagick , when I run rails s I'll get /Users/tomi/.rvm/gems/ruby-2.0.0-p247@ezaaa/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': dlopen(/Users/tomi/.rvm/gems/ruby-2.0.0-p247@ezaaa/gems/rmagick-2.13.2/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libMagickCore.5.dylib (LoadError) Referenced from: /Users/tomi/.rvm/gems/ruby-2.0.0-p247@ezaaa/gems/rmagick-2.13.2/lib/RMagick2.bundle Reason: image not found - /Users/tomi/

RMagick complaining about libMagickCore.5.dylib not found in OSX

对着背影说爱祢 提交于 2020-01-22 13:22:06
问题 after running brew upgrade imagemagick , when I run rails s I'll get /Users/tomi/.rvm/gems/ruby-2.0.0-p247@ezaaa/gems/activesupport-4.0.0/lib/active_support/dependencies.rb:228:in `require': dlopen(/Users/tomi/.rvm/gems/ruby-2.0.0-p247@ezaaa/gems/rmagick-2.13.2/lib/RMagick2.bundle, 9): Library not loaded: /usr/local/lib/libMagickCore.5.dylib (LoadError) Referenced from: /Users/tomi/.rvm/gems/ruby-2.0.0-p247@ezaaa/gems/rmagick-2.13.2/lib/RMagick2.bundle Reason: image not found - /Users/tomi/

Mongoid and carrierwave

爱⌒轻易说出口 提交于 2020-01-16 04:14:06
问题 In order to remain DRY, I have a class ModelBase that includes Mongoid document as follows: class ModelBase include Mongoid::Document alias_attribute :guid, :id def as_json(options = {}) azove_hash = options.merge(:methods => :guid) super azove_hash end end then all my models inherit from ModelBase and they seem to be working fine. However, there is one model where I use CarrierWave. when it inherits from ModelBase, the call to mount_uploader fails. And when I include the model inside with no

Uploader produces errors regarding the column in which it should store the path

让人想犯罪 __ 提交于 2020-01-15 08:37:27
问题 An Image model has a 1:1 association with an Organization model. In the organizations controller, the create method calls on an Image model method called upload_file . def create @organization = Organization.new(new_params) if @organization.save Image.upload_file(@organization.id) end end The upload_file method uses a carrierwave uploader to store a standard file in an Amazon S3 bucket. To this end, the Image model includes mount_uploader :file_name, ImageUploader . My question is how to

Uploading via a nested form and carrierwave doesn't seem to be working

六眼飞鱼酱① 提交于 2020-01-14 12:38:49
问题 I have a Profile model and Transcript model. My Profile model looks like this: class Profile < ActiveRecord::Base has_many :transcripts, dependent: :destroy accepts_nested_attributes_for :transcripts, allow_destroy: true end Transcript model looks like this: class Transcript < ApplicationRecord belongs_to :profile mount_uploader :url, TranscriptUploader end This is my TranscriptUploader class TranscriptUploader < CarrierWave::Uploader::Base storage :fog def store_dir "uploads/#{model.class.to

Uploading via a nested form and carrierwave doesn't seem to be working

瘦欲@ 提交于 2020-01-14 12:38:06
问题 I have a Profile model and Transcript model. My Profile model looks like this: class Profile < ActiveRecord::Base has_many :transcripts, dependent: :destroy accepts_nested_attributes_for :transcripts, allow_destroy: true end Transcript model looks like this: class Transcript < ApplicationRecord belongs_to :profile mount_uploader :url, TranscriptUploader end This is my TranscriptUploader class TranscriptUploader < CarrierWave::Uploader::Base storage :fog def store_dir "uploads/#{model.class.to

Carrierwave Rails 3 S3, save the file size to the database

不羁岁月 提交于 2020-01-13 19:55:47
问题 Using Carrierwave with Rails 3.2.6. All fine, except I need to sort a table where some attachments are displayed by file size. I'm using S3 for storage with fog. Let's say I have a Carrierwave showing like this: <%= @project.attachment %> I am able to show the size of the file by using '.size' after the field name: <%= @project.attachment.size %> shows the file size in bytes, but as I need to use an order clause when getting the records from the database, I cannot sort on this. Is there any

Carrierwave Rails 3 S3, save the file size to the database

孤人 提交于 2020-01-13 19:55:06
问题 Using Carrierwave with Rails 3.2.6. All fine, except I need to sort a table where some attachments are displayed by file size. I'm using S3 for storage with fog. Let's say I have a Carrierwave showing like this: <%= @project.attachment %> I am able to show the size of the file by using '.size' after the field name: <%= @project.attachment.size %> shows the file size in bytes, but as I need to use an order clause when getting the records from the database, I cannot sort on this. Is there any

Conditional image resizing with Carrierwave

强颜欢笑 提交于 2020-01-13 01:48:30
问题 I need to create different versions of uploaded image conditionally. I know Carrierwave supports this feature. But my requirements are a bit tricky. For each uploaded image I need to create 2 versions and need to scale the original image based on conditions. Below code will give you better idea what I am trying to do: version :leftright, :if => :image? do process :resize_to_fill => [667*2, 778*2] ,:if => :is_retina_resolution? process :resize_to_fill => [667, 778] ,:if => !:is_retina

Carrierwave Cropping

余生颓废 提交于 2020-01-12 10:01:55
问题 I have an CarrierWave ImageUploader which creates a couple of versions of an original image that need to be cropped based on values in my model (crop_x, crop_y, crop_w, and crop_h). class ImageUploader < CarrierWave::Uploader::Base include CarrierWave::MiniMagick ... version :t do process :cropper process :resize_to_fill => [75, 75] end ... def cropper manipulate! do |img| img = img.crop "#{model.crop_x}x#{model.crop_y}+#{model.crop_w}+#{model.crop_h}" img end end end The problem that I'm