Coder Social home page Coder Social logo

cloudinary / cloudinary_gem Goto Github PK

View Code? Open in Web Editor NEW
420.0 39.0 285.0 11.89 MB

Cloudinary GEM for Ruby on Rails integration

Home Page: https://cloudinary.com

Ruby 97.70% CoffeeScript 0.01% JavaScript 0.13% CSS 0.13% Shell 1.12% HTML 0.91%
ruby ruby-on-rails ruby-gem sdk-ruby cloudinary-ruby-sdk cloudinary-gem cloudinary cloudinary-sdk image-manipulation video-manipulation

cloudinary_gem's Introduction

Build Status Gem Version Gem Version

Cloudinary Ruby on Rails SDK

About

The Cloudinary Ruby on Rails SDK allows you to quickly and easily integrate your application with Cloudinary. Effortlessly optimize, transform, upload and manage your cloud's assets.

Note

This Readme provides basic installation and usage information. For the complete documentation, see the Ruby on Rails SDK Guide.

Table of Contents

Key Features

Version Support

SDK Version Ruby 1.9.3 Ruby 2.x Ruby 3.x
1.x
2.x
SDK Version Rails 5.x Rails 6.x Rails 7.x
1.x
2.x

Installation

gem install cloudinary

Usage

Setup

require 'cloudinary'

Transform and Optimize Assets

 cl_image_tag("sample.jpg", width: 100, height: 150, crop: "fill")

Upload

Cloudinary::Uploader.upload("my_picture.jpg")

CarrierWave Integration

Active Storage Integration

Security options

Samples

Contributions

Get Help

If you run into an issue or have a question, you can either:

About Cloudinary

Cloudinary is a powerful media API for websites and mobile apps alike, Cloudinary enables developers to efficiently manage, transform, optimize, and deliver images and videos through multiple CDNs. Ultimately, viewers enjoy responsive and personalized visual-media experiences—irrespective of the viewing device.

Additional Resources

Licence

Released under the MIT license.

cloudinary_gem's People

Contributors

aleksandar-cloudinary avatar assembler avatar binarypaladin avatar codeinvain avatar const-cloudinary avatar d-mendoza avatar frederfred avatar gtmax avatar gunterja avatar itaibenari avatar jamesharker avatar jc00ke avatar l8on avatar mikeys avatar momoip avatar nadavofi avatar nadavofir avatar nadavs avatar ollym avatar pdipietro avatar rmoriz avatar sergei-ndivi avatar tallevami avatar taragano avatar thedrow avatar tnir avatar tocker avatar tommyg-cld avatar yomesinc avatar zenspider avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

cloudinary_gem's Issues

Get resource count

There doesn't seem to be a way to get a resource count from the API at the moment, right?
Something like "count the number of resources with tag 'foo'".
Are there plans to add something like that at some point in time?

url is not updated

After updating the image, the url is not changed:

1.9.3p0 :002 > u.avatar.profile.url
=> "http://res.cloudinary.com/v2/image/upload/c_fill,h_128,w_128/v1335146483/rp6lfrey9kt30sinkhhmq.jpg"
1.9.3p0 :003 > u.avatar = File.open(Rails.root.to_s + "/app/assets/images/twitter_128.png")
=> #File:/media/v2/app/assets/images/twitter_128.png
1.9.3p0 :006 > File.exists? Rails.root.to_s + "/app/assets/images/twitter_128.png"
=> true
1.9.3p0 :007 > u.save
=> true
1.9.3p0 :008 > u.avatar.profile.url
=> "http://res.cloudinary.com/v2/image/upload/c_fill,h_128,w_128/v1335146483/rp6lfrey9kt30sinkhhmq.jpg"
1.9.3p0 :010 > u.reload.avatar.profile.url
=> "http://res.cloudinary.com/v2/image/upload/c_fill,h_128,w_128/v1335146483/rp6lfrey9kt30sinkhhmq.jpg"
1.9.3p0 :011 > u.reload.avatar.recreate_versions!
NoMethodError: undefined method read' for "v1335147051/rp6lfrey9kt30sinkhhmq.jpg":String from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/carrierwave-0.5.8/lib/carrierwave/uploader/cache.rb:73:incache_stored_file!'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/carrierwave-0.5.8/lib/carrierwave/uploader/versions.rb:179:in recreate_versions!' from (irb):11 from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands/console.rb:47:instart'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in start' from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands.rb:41:in<top (required)>'
from script/rails:10:in require' from script/rails:10:in

'
1.9.3p0 :013 > ApplicationController.helpers.cl_image_tag(u.avatar.profile.url)
=> "<img alt="Rp6lfrey9kt30sinkhhmq" src="http://res.cloudinary.com/v2/image/upload/c_fill,h_128,w_128/v1335146483/rp6lfrey9kt30sinkhhmq.jpg\" />"
1.9.3p0 :014 > u = User.find_by_username_or_email("mark")
=> #<User _id: 4f938f79e138232428000006, _type: nil, created_at: 2012-04-22 04:56:25 UTC, updated_at: 2012-04-22 04:56:29 UTC, avatar_filename: "v1335146483/rp6lfrey9kt30sinkhhmq.jpg", username: "mark", email: "[email protected]", avatar: "v1335147051/rp6lfrey9kt30sinkhhmq.jpg">
1.9.3p0 :015 > u.reload.avatar.profile.url
=> "http://res.cloudinary.com/v2/image/upload/c_fill,h_128,w_128/v1335147051/rp6lfrey9kt30sinkhhmq.jpg"
1.9.3p0 :016 >

I use rails 3.2.2 with mongoid, cloudinary 1.0.8

Cloudinary::Uploader.generate_sprite returns the wrong version

Hi there!

The title of the issue is pretty much it really. I've uploaded a couple of images with the same tag and ran Cloudinary::Uploader.generate_sprite for it, I obtained the sprite URL successfully but I added a couple of other images with the same tag and re-ran the sprite generation. Only problem is the URL returned and the version returned is the same as the first one!

I really don't know what to do because it seems like it generates the new sprite because when I fiddle with the url and add a version number I get an updated version, but I don't have the right one and I can't really keep track of them every time I update.

Am I doing something wrong? I have been over the doc many times but can't find any solution :(

Direct Image Upload - Rename Public ID after save

Okay, next issue I've found with using the direct image upload. It uses a temporary public_id like "pbpvcca4zwisdgdyhqlg." Even though I overrode the carrierwave public_id method, it does not update to the correct public_id after save.

I've looked through the Cloudinary::API and I do not see a call to update the public_id after the fact.

Is there a solution to this?

Invalid value for parameter image_kind

When i try to upload image using cl_form_tag i get the following error message passed as query string parameter to callback url:

?error=Invalid+value++for+parameter+image_kind

[FEATURE] Redmine integration

Redmine is a well known open source Ruby based "Issue Tracking" - System.

Maybe someone would provide a simple "image upload" function / gem.

This will be very glad

:-)

Don't talk to server during tests

Carrierwave's docs specify to do the following to speed up tests:

if Rails.env.test? or Rails.env.cucumber?
  CarrierWave.configure do |config|
    config.storage = :file
    config.enable_processing = false
  end
end

This doesn't work if you have include Cloudinary::CarrierWave in your uploader.

Thanks!

direct uploads

Even though Cloudinary supports it, your gem lacks the ability to upload images directly to your server, bypassing rails app. This was really important for me from scaling aspect, so I created helper methods that would allow me to do this. I blogged about it here: http://zogash.tumblr.com/post/20642999532/uploading-images-directly-to-cloudinary-from-rails

It would be awesome if you can add cl_form_tag method to CloudinaryHelper, and some convenience method for valid_cloudinary_response?.

generate_transformation_string destructively eats the transformation key out of the hash

I will soon have a pull request with tests that shows this bug and provides a fix. The generate_transformation_string method eats the 'transformatoin' key from the hash passed into it. If you're using attachinary, this hash is also used in the front end to generate form data, so the form ends up without the transformation key in it.

Logged as Ticket 8567 in the cloudinary support system. Additionally, after reading through the cloudinary gem code, I am not inspired with confidence to the backend service. We can do better than 50 lines long methods :)

Error with mongoid and uploader in embedded document

When you mount a carrierwave uploader to a Mongoid document which is embedded in another document, Cloudinary::CarrierWave throws an error.

This is because on this line of code (storage.rb:49)

model_class.where(:_id=>uploader.model._id).update_all(uploader.mounted_as=>name)
=> This is not possible for embedded documents.

As a result of this error, the version of the file is not updated

Below is the relevant stack trace:

Mongoid::Errors::InvalidCollection in MediaController#create

Access to the collection for Medium is not allowed since it is an embedded document, please access a collection from the root document.

mongoid (2.4.7) lib/mongoid/collections.rb:55:in collection' mongoid (2.4.7) lib/mongoid/contexts/mongo.rb:377:inupdate_all'
mongoid (2.4.7) lib/mongoid/criteria.rb:45:in update_all' cloudinary (1.0.24) lib/cloudinary/carrier_wave/storage.rb:49:instore_cloudinary_version'
cloudinary (1.0.24) lib/cloudinary/carrier_wave/storage.rb:31:in `store!'

Server error or downtime

Heads up: a vanilla upload in a previously-working spec started throwing the below exception. It'd be nice if the gem threw a more descriptive/concise/recoverable exception. Also, have you considered a status page?

 RuntimeError:
   Error parsing server response (500) - <!DOCTYPE html>
   <html>
   <head>
     <title>We're sorry, but something went wrong (500)</title>
     <style type="text/css">
       body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
       div.dialog {
         width: 25em;
         padding: 0 4em;
         margin: 4em auto 0 auto;
         border: 1px solid #ccc;
         border-right-color: #999;
         border-bottom-color: #999;
       }
       h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
     </style>
   </head>

   <body>
     <!-- This file lives in public/500.html -->
     <div class="dialog">
       <h1>We're sorry, but something went wrong.</h1>
       <p>We've been notified about this issue and we'll take a look at it shortly.</p>
     </div>
   </body>
   </html>
   . Got - 757: unexpected token at '<!DOCTYPE html>
   <html>
   <head>
     <title>We're sorry, but something went wrong (500)</title>
     <style type="text/css">
       body { background-color: #fff; color: #666; text-align: center; font-family: arial, sans-serif; }
       div.dialog {
         width: 25em;
         padding: 0 4em;
         margin: 4em auto 0 auto;
         border: 1px solid #ccc;
         border-right-color: #999;
         border-bottom-color: #999;
       }
       h1 { font-size: 100%; color: #f00; line-height: 1.5em; }
     </style>
   </head>

   <body>
     <!-- This file lives in public/500.html -->
     <div class="dialog">
       <h1>We're sorry, but something went wrong.</h1>
       <p>We've been notified about this issue and we'll take a look at it shortly.</p>
     </div>
   </body>
   </html>
   '
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/cloudinary-1.0.22/lib/cloudinary/uploader.rb:129:in `rescue in block in call_api'

 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/cloudinary-1.0.22/lib/cloudinary/uploader.rb:125:in `block in call_api'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `call'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/rest-client-1.6.7/lib/restclient/request.rb:228:in `process_result'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/rest-client-1.6.7/lib/restclient/request.rb:178:in `block in transmit'
 # /Users/shawndrost/.rvm/rubies/ruby-1.9.3-p125/lib/ruby/1.9.1/net/http.rb:745:in `start'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/rest-client-1.6.7/lib/restclient/request.rb:172:in `transmit'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/rest-client-1.6.7/lib/restclient/request.rb:64:in `execute'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/rest-client-1.6.7/lib/restclient/request.rb:33:in `execute'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/cloudinary-1.0.22/lib/cloudinary/uploader.rb:121:in `call_api'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/cloudinary-1.0.22/lib/cloudinary/uploader.rb:27:in `upload'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/cloudinary-1.0.22/lib/cloudinary/carrier_wave/storage.rb:26:in `store!'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/uploader/store.rb:59:in `block in store!'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/uploader/callbacks.rb:17:in `with_callbacks'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/uploader/store.rb:58:in `store!'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/mount.rb:345:in `store!'
 # /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/mount.rb:217:in `store_img!'

Doesn't support Carrierwave's url-based upload system

Using carrierwave's url-based uploader throws this exception:

ruby-1.9.3-p125 :001 > Picture.create remote_img_url: "http://lorempixel.com/240/85/?cachebust=7009",
NameError: undefined local variable or method `public_id' for Cloudinary::CarrierWave:Module
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/cloudinary-1.0.19/lib/cloudinary/carrier_wave.rb:113:in `split_format'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/cloudinary-1.0.19/lib/cloudinary/carrier_wave/process.rb:115:in `format'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/cloudinary-1.0.19/lib/cloudinary/carrier_wave.rb:50:in `filename'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/storage/abstract.rb:19:in `identifier'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/uploader/proxy.rb:35:in `identifier'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/mount.rb:296:in `write_identifier'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/carrierwave-0.6.2/lib/carrierwave/mount.rb:229:in `write_img_identifier'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:407:in `_run__3768434823215381851__save__2003508284864095768__callbacks'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:405:in `__run_callback'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:385:in `_run_save_callbacks'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activesupport-3.2.2/lib/active_support/callbacks.rb:81:in `run_callbacks'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/callbacks.rb:264:in `create_or_update'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/persistence.rb:84:in `save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/validations.rb:50:in `save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/attribute_methods/dirty.rb:22:in `save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:241:in `block (2 levels) in save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:208:in `transaction'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:241:in `block in save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:252:in `rollback_active_record_state!'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/transactions.rb:240:in `save'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/activerecord-3.2.2/lib/active_record/persistence.rb:45:in `create'
    from (irb):1
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in `start'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in `start'
    from /Users/shawndrost/.rvm/gems/ruby-1.9.3-p125@hb_server/gems/railties-3.2.2/lib/rails/commands.rb:41:in `<top (required)>'
    from script/rails:6:in `require'
    from script/rails:6:in `<main>'ruby-1.9.3-p125 :002 > Picture.create remote_img_url: "http://lorempixel.com/240/85/?cachebust=7009", user: User.first

Picture.rb looks something like this:

class Picture < ActiveRecord::Base
  mount_uploader :img, PictureUploader
end

Thanks in advance for any help!

Google+ Integration

Google+ integration is mentioned on the Cloudinary site however I can't seem to find any examples of it. If someone could post the format of the URL I'm more than happy to submit a pull request.

Public IDs should not start with a number

Hi there!

This is not a gem related problem but I can't figure out any other places to post a bug report. The public IDs generated automatically should not start with a number because it makes an invalid CSS class name when generating sprites.

Here's a link on CSS class name: http://stackoverflow.com/questions/448981/what-characters-are-valid-in-css-class-names

For the moment I might have to use custom public IDs, but I'd rather have them randomly generated on your side.

Hope this helps.

cloudinary:sync_static adds extra metadata on upload (causing an increase in file-size)

The cloudinary:sync_static rake task seems to add unnecessary metadata when uploading to Cloudinary (thus increases the download file-size).

In some cases, this can add 30-40% extra to the download file-size, thus negating the advantage of using a CDN.

Here are some example images, uploaded using a freshly created Rails app.

Before upload, these images were firstly locally processed through the ImageOptim app, to losslessly optimise files size.

The following URLs show the same image uploaded firstly by rake cloudinary:sync_static and then manually (using the Cloudinary web interface)

rails.png (6% file size difference)
sync: https://d3jpl91pxevbkh.cloudfront.net/greenplantswap-test/image/asset/v1354008225/rails-974a1303a93adf0580c266621193f232.png
manual: https://d3jpl91pxevbkh.cloudfront.net/greenplantswap-test/image/upload/v1354008247/nisdbyrtuwtca5cv45n1.png

user-icon (33% file size difference)
sync: https://d3jpl91pxevbkh.cloudfront.net/greenplantswap-test/image/asset/v1354008226/user-icon-500x500-797dcc0bbab18b058746977a3d196510.png
manual: https://d3jpl91pxevbkh.cloudfront.net/greenplantswap-test/image/upload/v1354008478/gfwiksjjfnrvmma8i3oi.png

home-in-action (41%file size difference)
sync: https://d3jpl91pxevbkh.cloudfront.net/greenplantswap-test/image/asset/v1354008911/home-in-action2-6a6a74a622ad4205a0bc696f5469d2a9.png
manual: https://d3jpl91pxevbkh.cloudfront.net/greenplantswap-test/image/upload/v1354008934/qn0ua9fhw7enehgxrhzq.png

If this metadata is necessary (e.g. for syncing purposes), please can it be automatically stripped whenever the image is requested via the download URL? (https://d3jpl91pxevbkh.cloudfront.net/greenplantswap-test/image/asset/***)

Cheers

Rick

(Cloudinary account: greenplantswap)

image_tag is breaking when cloudinary is used

Gem versions: rails (3.2.7) cloudinary (1.0.37)

I use S3 for storing images and want to explore cloudinary. I am trying the free account. Since I am a noob, first I want to learn the api by experimenting with it. For this I tried a small rails app. My index pages shows all the images from S3 using <% image_tag (url) %>. Next step is to select an image for upload and transformation using Cloudinary. But as soon as I try the cloudinary api, image_tag is throwing the following error:

NoMethodError in Images#home

Showing C:/Users/Ramesh/Documents/railsprojects/imageproc/app/views/images/home.html.erb where line #8 raised:

undefined method `match' for #URI::HTTP:0x6081858

Extracted source (around line #8):

5:


    6: <% b.objects.each do |o| %>
    7:
    8:
  1. <%= image_tag(o.url_for(:read, :secure => false), :size => "200x200") %>

    9: <%=o.key%>

    10: <%= "size: #{o.head.content_length}"%>
    11: <%= link_to "view", :controller => "images", :action => "view", :id => 1, :bucket => b.name, :key => o.key%>

    just by renaming clouldinary.yml to xxx.yml, all the images are displaying again.

    Help please to get image_tag working when using cloudinary.

API Feature: retrieving images by creation date

It would be great to have the ability to programmatically tag and untag images.

Users can upload as much images as they want using cloudinary javascript plugin. These images may never be used by the actual application (user can change his mind in the process).

Use case:

  • user uploads image using javascript -> image is automatically tagged with tmp tag (already supported)
  • when user submits the form, server processes all the images and through the admin_api it removes tmp tag from them
  • cron job contacts cloudinary to remove all images tagged with tmp that are older than 1 day

It would also require the ability to filter images based on creation date through api..

Error with cl_image_tag

I use mongoid with Rails 3.2.2, I cannot display uploaded image. Here is error that I got:

Loading development environment (Rails 3.2.2)
1.9.3p0 :001 > i = Image.last
=> <Image _id: 4f8e3c71e138231535000015, _type: nil, created_at: 2012-04-18 04:00:53 UTC, updated_at: 2012-04-18 04:00:53 UTC, urls_filename: "images.jpg", caption: nil, urls: nil, user_id: "4f8e3927e138231444000005", album_id: "4f8e3c53e138231535000005", orphaned: nil>
1.9.3p0 :002 > i.urls
=> /albums/image/4f8e3c71e138231535000015/images.jpg
1.9.3p0 :003 > i.urls.thumb
=> /uploads/thumb_images.jpg
1.9.3p0 :004 > ApplicationController.helpers.image_tag(i.urls)
NoMethodError: undefined method match' for /albums/image/4f8e3c71e138231535000015/images.jpg:ImageUploader from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/utils.rb:57:incloudinary_url'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/helper.rb:109:in cloudinary_url' from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/helper.rb:11:incl_image_tag'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/helper.rb:28:in image_tag' from (irb):4 from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands/console.rb:47:instart'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in start' from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands.rb:41:in<top (required)>'
from script/rails:10:in require' from script/rails:10:in

'
1.9.3p0 :005 > ApplicationController.helpers.image_tag(i.urls.thumb)
NoMethodError: undefined method match' for /uploads/thumb_images.jpg:#<Class:0xbe9f830> from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/utils.rb:57:incloudinary_url'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/helper.rb:109:in cloudinary_url' from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/helper.rb:11:incl_image_tag'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/helper.rb:28:in image_tag' from (irb):5 from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands/console.rb:47:instart'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in start' from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands.rb:41:in<top (required)>'
from script/rails:10:in require' from script/rails:10:in'
1.9.3p0 :006 > ApplicationController.helpers.cl_image_tag(i.urls)
NoMethodError: undefined method match' for /albums/image/4f8e3c71e138231535000015/images.jpg:ImageUploader from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/utils.rb:57:incloudinary_url'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/helper.rb:109:in cloudinary_url' from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/helper.rb:11:incl_image_tag'
from (irb):6
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands/console.rb:47:in start' from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands/console.rb:8:instart'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands.rb:41:in <top (required)>' from script/rails:10:inrequire'
from script/rails:10:in <main>' 1.9.3p0 :007 > ApplicationController.helpers.cl_image_tag(i.urls.thumb) NoMethodError: undefined methodmatch' for /uploads/thumb_images.jpg:#Class:0xbe9f830
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/utils.rb:57:in cloudinary_url' from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/helper.rb:109:incloudinary_url'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/cloudinary-1.0.8/lib/cloudinary/helper.rb:11:in cl_image_tag' from (irb):7 from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands/console.rb:47:instart'
from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands/console.rb:8:in start' from /usr/local/rvm/gems/ruby-1.9.3-p0/gems/railties-3.2.2/lib/rails/commands.rb:41:in<top (required)>'
from script/rails:10:in require' from script/rails:10:in'
1.9.3p0 :008 >

[carrierwave] ":mount_on" option ignored

mount_uploader :editorial_asset, EditorialAssetUploader, mount_on: "file_name"
ActiveRecord::StatementInvalid (PG::Error: ERROR:  column "editorial_asset" of relation "editorial_assets" does not exist
LINE 1: UPDATE "editorial_assets" SET "editorial_asset" = 'v13389008...

here the correct column should be file_name

RuntimeError: Invalid value ... for parameter image_file_type

I'm using latest version of your gem (1.0.22), and when I try to upload image without extension

Cloudinary::Uploader.upload("http://t1.gstatic.com/images?q=tbn:ANd9GcTzXvEKaysQX3ckspMRPcUtxAxFdx0fsqwCc8s4demIyILmrNqnZA")

i get RuntimeError

RuntimeError: Invalid value com/images for parameter image_file_type

I tried with adding format option and it worked

Cloudinary::Uploader.upload("http://t1.gstatic.com/images?q=tbn:ANd9GcTzXvEKaysQX3ckspMRPcUtxAxFdx0fsqwCc8s4demIyILmrNqnZA", format: "jpg")

But then I can't add named transformation as an option (it is ignored).

Cloudinary::Uploader.upload("http://t1.gstatic.com/images?q=tbn:ANd9GcTzXvEKaysQX3ckspMRPcUtxAxFdx0fsqwCc8s4demIyILmrNqnZA", format: "jpg", transformation: "avatar")

Transformation option when uploading image with extension works fine

Cloudinary::Uploader.upload("http://hirenj.files.wordpress.com/2012/02/nate.jpg", transformation: "avatar")

This one also ignores transformation option

Cloudinary::Uploader.upload("http://hirenj.files.wordpress.com/2012/02/nate.jpg", transformation: "avatar", format: "jpg")

Commits without tests

Hello. Just a quick observation: there seem to be a number of commits going through that change production code without changing any test code. This might indicate a lack of test coverage. I haven't actually investigated, just thought I'd bring it up.

to_json error

I got undefined method include?' for nil:NilClass Stack Trace: cloudinary (1.0.4) lib/cloudinary/carrier_wave.rb:127:informat'
cloudinary (1.0.4) lib/cloudinary/carrier_wave.rb:149:in my_filename' cloudinary (1.0.4) lib/cloudinary/carrier_wave.rb:136:inurl'
carrierwave (0.5.8) lib/carrierwave/uploader/url.rb:30:in as_json' activesupport (3.2.2) lib/active_support/json/encoding.rb:47:inblock in encode'
activesupport (3.2.2) lib/active_support/json/encoding.rb:77:in check_for_circular_references' activesupport (3.2.2) lib/active_support/json/encoding.rb:46:inencode'
activesupport (3.2.2) lib/active_support/json/encoding.rb:31:in encode' activesupport (3.2.2) lib/active_support/core_ext/object/to_json.rb:16:into_json'
app/controllers/application_controller.rb:21:in `to_json'

When I call user.to_json, I use carrierwave for mongoid (Rails 3.2.2)

image method stops returning correct URL

I just upgraded to the latest Cloudinary gem and Mongoid 3, and now when calling photo.image.url or photo.image_url, it returns the default URL, rather than the correct, full Cloudinary URL:

1.9.3p194 :003 > a.photos.first['image']
 => "v1350288333/507bc3c82a450b14bd00e00a.jpg" 
1.9.3p194 :004 > a.photos.first.image
 => /assets/fallback/default.png 
1.9.3p194 :005 > 

Process tags doesn't seem to work

When I add the following to an uploader and after and image upload, I don't see the tags showing for the image:

process :tags => ['tag1', 'tag2', tag3']

Using cl_form_tag

When I try to use cl_form_tag, it says that the method is undefined. How am I supposed to call it?
Also, when an image is uploaded with cl_form_tag, how am I supposed to set the name of the image (or retrieve the name after uploading) so I can associate the image with a record?
Thanks!

image not rotating when i use :angle => :exif

images that are taken sideways from a cameraphone are not being rotated automatically when i use :angle => :exif.

i use rails and this is the code i have put into my view.

<%= cl_image_tag(content.image_url.to_s, :html_width => 500, :html_height => 150, :crop => :fill, :angle => :exif) if content.image? %>

nil input to image_tag throws exception

This was't throwing an exception before the cloudinary gem was installed. In this case the reference is resolving to nil.

<% image_tag( some_ref.try(:to_s) ) %>

/gems/cloudinary-1.0.12/lib/cloudinary/utils.rb:66:in cloudinary_url' /gems/cloudinary-1.0.12/lib/cloudinary/helper.rb:118:incloudinary_url'
/gems/cloudinary-1.0.12/lib/cloudinary/helper.rb:12:in cl_image_tag' /gems/cloudinary-1.0.12/lib/cloudinary/helper.rb:29:inimage_tag'
app/views/tour_books/_client_form.html.erb:10:in `block in _app_views_tour_books__client_form_html_erb___1659920891812517767_82968620'

resize_and_pad doesn't work

In a number of places that we use MiniMagick, there is a transformation :resize_and_pad, however in the Cloudinary gem the code appears to be wrong, and in the switch stmt it is usig :resize_to_pad instead of :resize_and_pad:

    def resize_and_pad(width, height, background=:transparent, gravity="Center")
      process :resize_and_pad => [width, height, background, gravity]
    end    

when :resize_to_pad
        set_or_yell(transformation, :width, args[0])    
        set_or_yell(transformation, :height, args[1])
        set_or_yell(transformation, :gravity, args[3].to_s.downcase)
        set_or_yell(transformation, :crop, :pad)

(Rails4 + Ruby 2.0) Error undefined method `image_path' for class `Sass::Rails::Resolver'

Rails 4.0.0.beta and Ruby 2.0 -- getting this error when I go to start my application:

   undefined method `image_path' for class `Sass::Rails::Resolver'
   /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/cloudinary-1.0.45/lib/cloudinary/helper.rb:218:in `<class:Resolver>'
   /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/cloudinary-1.0.45/lib/cloudinary/helper.rb:217:in `<top (required)>'
   /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/cloudinary-1.0.45/lib/cloudinary.rb:17:in `require'
   /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/cloudinary-1.0.45/lib/cloudinary.rb:17:in `<top (required)>'
   /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in `require'
   /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.0/lib/bundler/runtime.rb:72:in `block (2 levels) in require'
   /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in `each'
   /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.0/lib/bundler/runtime.rb:70:in `block in require'
   /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in `each'
   /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.0/lib/bundler/runtime.rb:59:in `require'
   /home/vagrant/.rvm/gems/ruby-2.0.0-p0/gems/bundler-1.3.0/lib/bundler.rb:132:in `require'

I have sprockets-rails and sass-rails in the :assets group of my Gemfile already:

   group :assets do
     gem 'coffee-rails', github: 'rails/coffee-rails'
     gem 'sprockets-rails', github: 'rails/sprockets-rails'
     gem 'sass-rails', github: 'rails/sass-rails'
     gem 'uglifier', '>= 1.0.3'
   end

Any ideas?

issues with destroy

i am using cloudinary with attachinary gem, and when i try to remove an image i am getting this error

NoMethodError (undefined method `closed?' for #<Hash:0x007fd2ae94eb38>):
  rest-client (1.6.7) lib/restclient/payload.rb:109:in `close'
  rest-client (1.6.7) lib/restclient/request.rb:66:in `ensure in execute'
  rest-client (1.6.7) lib/restclient/request.rb:66:in `execute'
  rest-client (1.6.7) lib/restclient/request.rb:33:in `execute'
  cloudinary (1.0.39) lib/cloudinary/uploader.rb:153:in `call_api'
  cloudinary (1.0.39) lib/cloudinary/uploader.rb:45:in `destroy'
  attachinary (1.0.1) lib/attachinary/orm/file_mixin.rb:29:in `destroy_file'
  activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `_run__2529301267074229315__destroy__2096584655227278472__callbacks'
  activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_destroy_callbacks'
  activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
  activerecord (3.2.8) lib/active_record/callbacks.rb:254:in `destroy'
  activerecord (3.2.8) lib/active_record/transactions.rb:236:in `block in destroy'
  activerecord (3.2.8) lib/active_record/transactions.rb:295:in `block in with_transaction_returning_status'
  activerecord (3.2.8) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
  activerecord (3.2.8) lib/active_record/transactions.rb:208:in `transaction'
  activerecord (3.2.8) lib/active_record/transactions.rb:293:in `with_transaction_returning_status'
  activerecord (3.2.8) lib/active_record/transactions.rb:236:in `destroy'
  activerecord (3.2.8) lib/active_record/associations/has_many_association.rb:89:in `block in delete_records'
  activerecord (3.2.8) lib/active_record/associations/has_many_association.rb:89:in `each'
  activerecord (3.2.8) lib/active_record/associations/has_many_association.rb:89:in `delete_records'
  activerecord (3.2.8) lib/active_record/associations/collection_association.rb:464:in `remove_records'
  activerecord (3.2.8) lib/active_record/associations/collection_association.rb:457:in `block in delete_or_destroy'
  activerecord (3.2.8) lib/active_record/associations/collection_association.rb:149:in `block in transaction'
  activerecord (3.2.8) lib/active_record/connection_adapters/abstract/database_statements.rb:192:in `transaction'
  activerecord (3.2.8) lib/active_record/transactions.rb:208:in `transaction'
  activerecord (3.2.8) lib/active_record/associations/collection_association.rb:148:in `transaction'
  activerecord (3.2.8) lib/active_record/associations/collection_association.rb:457:in `delete_or_destroy'
  activerecord (3.2.8) lib/active_record/associations/collection_association.rb:229:in `delete'
  activerecord (3.2.8) lib/active_record/associations/collection_association.rb:157:in `delete_all'
  activerecord (3.2.8) lib/active_record/associations/collection_proxy.rb:46:in `delete_all'
  activerecord (3.2.8) lib/active_record/associations/collection_proxy.rb:121:in `clear'
  attachinary (1.0.1) lib/attachinary/orm/active_record/extension.rb:78:in `block in attachinary'
  activerecord (3.2.8) lib/active_record/attribute_assignment.rb:85:in `block in assign_attributes'
  activerecord (3.2.8) lib/active_record/attribute_assignment.rb:78:in `each'
  activerecord (3.2.8) lib/active_record/attribute_assignment.rb:78:in `assign_attributes'
  activeadmin (0.5.0) lib/active_admin/resource_controller/callbacks.rb:38:in `update_resource'
  inherited_resources (1.3.1) lib/inherited_resources/actions.rb:45:in `update'
  activeadmin (0.5.0) lib/active_admin/resource_controller/actions.rb:56:in `update'
  actionpack (3.2.8) lib/action_controller/metal/implicit_render.rb:4:in `send_action'
  actionpack (3.2.8) lib/abstract_controller/base.rb:167:in `process_action'
  actionpack (3.2.8) lib/action_controller/metal/rendering.rb:10:in `process_action'
  actionpack (3.2.8) lib/abstract_controller/callbacks.rb:18:in `block in process_action'
  activesupport (3.2.8) lib/active_support/callbacks.rb:447:in `_run__553778273243809169__process_action__3698666919862791040__callbacks'
  activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_process_action_callbacks'
  activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.8) lib/abstract_controller/callbacks.rb:17:in `process_action'
  actionpack (3.2.8) lib/action_controller/metal/rescue.rb:29:in `process_action'
  actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:30:in `block in process_action'
  activesupport (3.2.8) lib/active_support/notifications.rb:123:in `block in instrument'
  activesupport (3.2.8) lib/active_support/notifications/instrumenter.rb:20:in `instrument'
  activesupport (3.2.8) lib/active_support/notifications.rb:123:in `instrument'
  actionpack (3.2.8) lib/action_controller/metal/instrumentation.rb:29:in `process_action'
  actionpack (3.2.8) lib/action_controller/metal/params_wrapper.rb:207:in `process_action'
  activerecord (3.2.8) lib/active_record/railties/controller_runtime.rb:18:in `process_action'
  actionpack (3.2.8) lib/abstract_controller/base.rb:121:in `process'
  actionpack (3.2.8) lib/abstract_controller/rendering.rb:45:in `process'
  actionpack (3.2.8) lib/action_controller/metal.rb:203:in `dispatch'
  actionpack (3.2.8) lib/action_controller/metal/rack_delegation.rb:14:in `dispatch'
  actionpack (3.2.8) lib/action_controller/metal.rb:246:in `block in action'
  actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in `call'
  actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:73:in `dispatch'
  actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:36:in `call'
  journey (1.0.4) lib/journey/router.rb:68:in `block in call'
  journey (1.0.4) lib/journey/router.rb:56:in `each'
  journey (1.0.4) lib/journey/router.rb:56:in `call'
  actionpack (3.2.8) lib/action_dispatch/routing/route_set.rb:600:in `call'
  omniauth (1.1.1) lib/omniauth/strategy.rb:177:in `call!'
  omniauth (1.1.1) lib/omniauth/strategy.rb:157:in `call'
  omniauth (1.1.1) lib/omniauth/builder.rb:48:in `call'
  warden (1.2.1) lib/warden/manager.rb:35:in `block in call'
  warden (1.2.1) lib/warden/manager.rb:34:in `catch'
  warden (1.2.1) lib/warden/manager.rb:34:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/best_standards_support.rb:17:in `call'
  rack (1.4.1) lib/rack/etag.rb:23:in `call'
  rack (1.4.1) lib/rack/conditionalget.rb:35:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/head.rb:14:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/params_parser.rb:21:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/flash.rb:242:in `call'
  rack (1.4.1) lib/rack/session/abstract/id.rb:205:in `context'
  rack (1.4.1) lib/rack/session/abstract/id.rb:200:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/cookies.rb:339:in `call'
  activerecord (3.2.8) lib/active_record/query_cache.rb:64:in `call'
  activerecord (3.2.8) lib/active_record/connection_adapters/abstract/connection_pool.rb:473:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:28:in `block in call'
  activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `_run__3066108520666796579__call__2096584655227278472__callbacks'
  activesupport (3.2.8) lib/active_support/callbacks.rb:405:in `__run_callback'
  activesupport (3.2.8) lib/active_support/callbacks.rb:385:in `_run_call_callbacks'
  activesupport (3.2.8) lib/active_support/callbacks.rb:81:in `run_callbacks'
  actionpack (3.2.8) lib/action_dispatch/middleware/callbacks.rb:27:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/reloader.rb:65:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/remote_ip.rb:31:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/debug_exceptions.rb:16:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/show_exceptions.rb:56:in `call'
  railties (3.2.8) lib/rails/rack/logger.rb:26:in `call_app'
  railties (3.2.8) lib/rails/rack/logger.rb:16:in `call'
  quiet_assets (1.0.1) lib/quiet_assets.rb:20:in `call_with_quiet_assets'
  actionpack (3.2.8) lib/action_dispatch/middleware/request_id.rb:22:in `call'
  rack (1.4.1) lib/rack/methodoverride.rb:21:in `call'
  rack (1.4.1) lib/rack/runtime.rb:17:in `call'
  activesupport (3.2.8) lib/active_support/cache/strategy/local_cache.rb:72:in `call'
  rack (1.4.1) lib/rack/lock.rb:15:in `call'
  actionpack (3.2.8) lib/action_dispatch/middleware/static.rb:62:in `call'
  railties (3.2.8) lib/rails/engine.rb:479:in `call'
  railties (3.2.8) lib/rails/application.rb:223:in `call'
  rack (1.4.1) lib/rack/content_length.rb:14:in `call'
  railties (3.2.8) lib/rails/rack/log_tailer.rb:17:in `call'
  rack (1.4.1) lib/rack/handler/webrick.rb:59:in `service'
  /Users/zacksiri/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:138:in `service'
  /Users/zacksiri/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/webrick/httpserver.rb:94:in `run'
  /Users/zacksiri/.rbenv/versions/1.9.3-p194/lib/ruby/1.9.1/webrick

Issue while using Cloudinary, Carrierwave, Ckeditor with Rails Admin

Hello,

i am trying to use Ckeditor with Rails Admin. Where I am using Carrierwave and cloud storage as cloudinary. After making all the settings I can see CKeditor is able to save the file on local storage and then it creates url of cloudinary where actually image should store. But problem is image is not uploaded from that local folder to cloudinary.
Where as my simple file upload works correctly. Without any issue.

One more question which I have here is - what should be the storage name when I am using cloudinary? as for file and Amazon S3 we have names as file and s3

Please respond

Thanks

Direct Upload - Destroy Temporary Uploads

First, I'm sorry to keep opening these as issues. You're just way way too responsive on here! (And I'm loving it and cloudinary! Thank you!)

Now my question! Is there an easy recommended way to clear temporary direct uploads? As in if my user directly uploads an image (using your javascript) to cloudinary, but I never attach it to a carrierwave object.

What's the recommended way to handling deleting those unused assets?

Demo for mongoid wanted

I came around and wanna know if mongoid is supported.
All examples of cloudinary are only ActiveRecord based.
Also on the website of cloudinary.com I did not found any word about mongoid.

Can you provide a "simple setup" or "Demo App" for using

  • cloudinary-carrierwave-mongoid or
  • cloudinary-mongoid

At this time my setup looks like this:

class ImageUploader < CarrierWave::Uploader::Base
  include Cloudinary::CarrierWave
      def cache_dir
        "#{Rails.root}/tmp/uploads"
      end
      version :thumb do
        process :resize_to_fit => [200, 200]
      end
      def public_id
         return model.location_image_id
      end

Class Location

 class Location
    include Mongoid::Document
    mount_uploader :image, ImageUploader

YML Config File exists.

Saving on Cloudinary does not work, but on my local file-system

Any help?

Thanks

Cloudinary Gem Side-effects With Rails Admin

After installing the gem and running in production, we noticed that there were some strange interactions with the rails admin gem. For example these image assets were no longer getting served (notice the double 'rails_admin' in the firs url):

http://localhost:3000/assets/rails_admin/rails_admin/multiselect/icon_sprite.png

but should be:

http://localhost:3000/assets/rails_admin/multiselect/icon_sprite.png

I think it's how the assets are being precompiled for rails_admin:

with cloudinary gem installed:
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {
background: url(/rails_admin/aristo/images/icon_sprite.png) -16px 0 no-repeat !important;
}

without gem installed:
.ui-state-error .ui-icon, .ui-state-error-text .ui-icon {
background: url(/assets/rails_admin/aristo/images/icon_sprite.png) -16px 0 no-repeat !important;
}

This happens even with:

enhance_image_tag: false
static_image_support: false

API Feature: deleting resources by tag

It would be awesome to have this ability.

I'm currently using rake task with code like this:

begin
  ids = Cloudinary::Api.resources_by_tag('development_env', max_results: 100)["resources"].map{|r| r["public_id"] }
  Cloudinary::Api.delete_resources(ids)
  sleep 1
end until ids.empty?

But it would be much more elegant solution to have something like this instead:

Cloudinary::Api.delete_resources_by_tag('development_env')

"General error" using CarrierWave, but image has been uploaded

I'm using cloudinary with carrierwave; the image is uploaded correctly, but Ruby on Rails raises an exception with the message: "General error":

lib/cloudinary/carrier_wave/storage.rb:33:in `store!'

I debugged a bit and found that store! will call upload inside lib/cloudinary/upload.rb; the error is inside call_api (called by upload) in the same file, around line 158:

RestClient::Request.execute(:method => :post, :url => api_url, :payload => params.reject{|k, v| v.nil? || v==""}, :timeout=>60) do
  |response, request, tmpresult|

response contains the error that is later returned to store!; however the image is uploaded successfully to cloudinary. Am I missing something?

cl_image_tag adds non-dynamic height/width for :crop => :fit

When using cl_image_tag with :crop => :fit, it passes the non-dynamic height/width variables to the image tag which makes the image size incorrectly.

For example:

cl_image_tag(bonus.image.filename, :width => 250, :height => 250, :crop => :fit)

This always produces an image tag with height=250 and width=250 regardless of how the image is cropped. cl_image_tag should not pass through the height and width if crop is set to fit or should use a different variable to pass the cloudinary vs the image options.

Akamai secure not used

It is very important to our customers they feel (and are) secure when on our site, so we have an SSL. However, the SSL is prompting a warning in some browsers because of insecure assets. The asset is a Cloudinary image.

It's my understanding this gem should recognize our SSL and use the HTTPS version of the image, but it does not. Furthermore, passing :secure => true in our cl_image_tag call does not produce an HTTPS image.

You can see it in action here:
https://www.theweddingfavor.com/r/1

Any ideas on this?

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.