How to add tags when uploading images in CarrierWave?

In order to assign a tag while uploading an image, you can use the following:

class PictureUploader < CarrierWave::Uploader::Base  
  include Cloudinary::CarrierWave

  process :convert => 'jpg'
  cloudinary_transformation 
  :quality => 80
  process :assign_tags

  def assign_tags      
    return :tags => ['tag', model.name]      
  end
end

You can define any method that returns a hash of parameters. Then you can apply the custom method using the 'process' call. The parameters are passed to the upload API call.

Have more questions? Submit a request

Comments

Powered by Zendesk