cloudinary 1.0.18 → 1.0.19

Sign up to get free protection for your applications and to get access to all the features.
data/README.md CHANGED
@@ -1,8 +1,15 @@
1
1
  Cloudinary
2
2
  ==========
3
3
 
4
- Cloudinary allows web applications to manage web resources in the cloud leveraging cloud-solutions.
5
- Cloudinary offers a solution to the entire asset management workflow, from upload to transformations, optimizations, storage and delivery.
4
+ Cloudinary is a cloud service that offers a solution to a web application's entire image management pipeline.
5
+
6
+ Easily upload images to the cloud. Automatically perform smart image resizing, cropping and conversion without installing any complex software. Integrate Facebook or Twitter profile image extraction in a snap, in any dimension and style to match your website’s graphics requirements. Images are seamlessly delivered through a fast CDN, and much much more.
7
+
8
+ Cloudinary offers comprehensive APIs and administration capabilities and is easy to integrate with any web application, existing or new.
9
+
10
+ Cloudinary provides URL and HTTP based APIs that can be easily integrated with any Web development framework.
11
+
12
+ For Ruby on Rails, Cloudinary provides a GEM for simplifying the integration even further.
6
13
 
7
14
  ## Setup ######################################################################
8
15
 
@@ -10,40 +17,162 @@ To install the Cloudinary Ruby GEM, run:
10
17
 
11
18
  $ gem install cloudinary
12
19
 
13
- If you use Rails 3.x or higher, edit your Gemfile, add the following line and run 'bundle'
20
+ If you use Rails 3.x or higher, edit your `Gemfile`, add the following line and run `bundle install`
21
+
22
+ $ gem 'cloudinary'
23
+
24
+ Or in Rails 2.x, edit your `environment.rb` and add:
25
+
26
+ $ config.gem 'cloudinary'
27
+
28
+ If you would like to use our optional integration module of image uploads with ActiveRecord using `CarrierWave`, install CarrierWave GEM:
29
+
30
+ Rails 3.x: edit your `Gemfile` and run `bundle install`:
31
+
32
+ $ gem 'carrierwave'
33
+ $ gem 'cloudinary'
34
+
35
+ Rails 2.x environment.rb:
36
+
37
+ $ config.gem 'carrierwave', :version => '~> 0.4.1'
38
+ $ config.gem 'cloudinary'
39
+
40
+
41
+ *Note: The CarrierWave GEM should be loaded before the Cloudinary GEM.*
42
+
43
+ ## Try it right away
44
+
45
+ Sign up for a [free account](https://cloudinary.com/users/register/free) so you can try out image transformations and seamless image delivery through CDN.
46
+
47
+ *Note: Replace `demo` in all the following examples with your Cloudinary's `cloud name`.*
48
+
49
+ Accessing an uploaded image with the `sample` public ID through a CDN:
50
+
51
+ http://res.cloudinary.com/demo/image/upload/sample.jpg
52
+
53
+ ![Sample](https://d3jpl91pxevbkh.cloudfront.net/demo/image/upload/w_0.4/sample.jpg "Sample")
54
+
55
+ Generating a 150x100 version of the `sample` image and downloading it through a CDN:
56
+
57
+ http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill/sample.jpg
58
+
59
+ ![Sample 150x100](https://d3jpl91pxevbkh.cloudfront.net/demo/image/upload/w_150,h_100,c_fill/sample.jpg "Sample 150x100")
60
+
61
+ Converting to a 150x100 PNG with rounded corners of 20 pixels:
62
+
63
+ http://res.cloudinary.com/demo/image/upload/w_150,h_100,c_fill,r_20/sample.png
64
+
65
+ ![Sample 150x150 Rounded PNG](https://d3jpl91pxevbkh.cloudfront.net/demo/image/upload/w_150,h_100,c_fill,r_20/sample.png "Sample 150x150 Rounded PNG")
66
+
67
+ For plenty more transformation options, see our [image transformations documentation](http://cloudinary.com/documentation/image_transformations).
68
+
69
+ Generating a 120x90 thumbnail based on automatic face detection of the Facebook profile picture of Bill Clinton:
70
+
71
+ http://res.cloudinary.com/demo/image/facebook/c_thumb,g_face,h_90,w_120/billclinton.jpg
72
+
73
+ ![Facebook 90x120](https://d3jpl91pxevbkh.cloudfront.net/demo/image/facebook/c_thumb,g_face,h_90,w_120/billclinton.jpg "Facebook 90x200")
74
+
75
+ For more details, see our documentation for embedding [Facebook](http://cloudinary.com/documentation/facebook_profile_pictures) and [Twitter](http://cloudinary.com/documentation/twitter_profile_pictures) profile pictures.
76
+
77
+
78
+ ## Usage
79
+
80
+ ### Configuration
81
+
82
+ Each request for building a URL of a remote cloud resource must have the `cloud_name` parameter set.
83
+ Each request to our secure APIs (e.g., image uploads, eager sprite generation) must have the `api_key` and `api_secret` parameters set. See [API, URLs and access identifiers](http://cloudinary.com/documentation/api_and_access_identifiers) for more details.
84
+
85
+ Setting the `cloud_name`, `api_key` and `api_secret` parameters can be done either directly in each call to a Cloudinary method or by globally setting using a YAML configuration file.
86
+
87
+ Cloudinary looks for an optional file named cloudinary.yml, which should be located under the `config` directory of your Rails project.
88
+ It contains settings for each of your deployment environments. You can always override the values specified in `cloudinary.yml` by passing different values in specific Cloudinary calls.
89
+
90
+ You can [download your customized cloudinary.yml](https://cloudinary.com/console/cloudinary.yml) configuration file using our Management Console.
91
+
92
+
93
+ ### Embedding and transforming images
94
+
95
+ Any image uploaded to Cloudinary can be transformed and embedded using powerful view helper methods:
96
+
97
+ The following example generates an image of an uploaded `sample` image while transforming it to fill a 100x150 rectangle:
98
+
99
+ cl_image_tag("sample.jpg", :width => 100, :height => 150, :crop => :fill)
100
+
101
+ Another example, emedding a smaller version of an uploaded image while generating a 90x90 face detection based thumbnail:
102
+
103
+ cl_image_tag("woman.jpg", :width => 90, :height => 90,
104
+ :crop => :thumb, :gravity => :face)
105
+
106
+ You can provide either a Facebook name or a numeric ID of a Facebook profile or a fan page.
107
+
108
+ Embedding a Facebook profile to match your graphic design is very simple:
109
+
110
+ facebook_profile_image_tag("billclinton.jpg", :width => 90, :height => 130,
111
+ :crop => :fill, :gravity => :north_west)
112
+
113
+ Same goes for Twitter:
114
+
115
+ twitter_name_profile_image_tag("billclinton.jpg")
116
+
117
+ See [our documentation](http://cloudinary.com/documentation/rails_integration#display_and_transform) for more information about displaying and transforming images in Rails.
118
+
119
+
120
+ ### Upload
121
+
122
+ Assuming you have your Cloudinary configuration parameters defined (`cloud_name`, `api_key`, `api_secret`), uploading to Cloudinary is very simple.
123
+
124
+ The following example uploads a local JPG to the cloud:
125
+
126
+ Cloudinary::Uploader.upload("my_picture.jpg")
127
+
128
+ The uploaded image is assigned a randomly generated public ID. The image is immediately available for download through a CDN:
129
+
130
+ cl_image_tag("abcfrmo8zul1mafopawefg.jpg")
131
+
132
+ http://res.cloudinary.com/demo/image/upload/abcfrmo8zul1mafopawefg.jpg
133
+
134
+ You can also specify your own public ID:
135
+
136
+ Cloudinary::Uploader.upload("http://www.example.com/image.jpg", :public_id => 'sample_remote')
14
137
 
15
- $ gem 'cloudinary'
138
+ cl_image_tag("sample_remote.jpg")
16
139
 
17
- Or in Rails 2.x, edit your environment.rb and add:
140
+ http://res.cloudinary.com/demo/image/upload/sample_remote.jpg
141
+
142
+ See [our documentation](http://cloudinary.com/documentation/rails_integration#direct_upload) for plenty more options of direct uploading to the cloud from your Ruby code.
18
143
 
19
- $ config.gem 'cloudinary'
20
144
 
21
- If you would like to use our optional integration module of image uploads with ActiveRecord using CarrierWave, install CarrierWave GEM:
145
+ ### CarrierWave Integration
22
146
 
23
- $ gem install carrierwave
147
+ Cloudinary's Ruby GEM includes an optional plugin for [CarrierWave](https://github.com/jnicklas/carrierwave). If you already use CarrierWave, simply include `Cloudinary::CarrierWave` to switch to cloud storage and image processing in the cloud.
24
148
 
25
- Rails 3.x Gemfile:
149
+ class PictureUploader < CarrierWave::Uploader::Base
150
+ include Cloudinary::CarrierWave
151
+ ...
152
+ end
26
153
 
27
- $ gem 'carrierwave'
28
- $ gem 'cloudinary'
154
+ For more details on CarrierWave integration see [our documentation](http://cloudinary.com/documentation/rails_integration#carrierwave_upload).
29
155
 
30
- Rails 2.x environment.rb
156
+ We also published an interesting blog post about [Ruby on Rails image uploads with CarrierWave and Cloudinary](http://cloudinary.com/blog/ruby_on_rails_image_uploads_with_carrierwave_and_cloudinary).
31
157
 
32
- $ config.gem 'carrierwave', :version => '~> 0.4.1'
33
- $ config.gem 'cloudinary'
34
158
 
35
- Note: The CarrierWave GEM should be loaded before the Cloudinary GEM.
159
+ ## Additional resources ##########################################################
36
160
 
161
+ Additional resources are available at:
37
162
 
38
- ## Usage ######################################################################
163
+ * [Website](http://cloudinary.com)
164
+ * [Documentation](http://cloudinary.com/documentation)
165
+ * [Documentation for Ruby on Rails integration](http://cloudinary.com/documentation/rails_integration)
166
+ * [Image transformations documentation](http://cloudinary.com/documentation/image_transformations)
167
+ * [Upload API documentation](http://cloudinary.com/documentation/upload_images)
39
168
 
40
- Refer to Cloudinary Documentation at:
41
- http://cloudinary.com/documentation
169
+ ## Support
42
170
 
171
+ You can [open an issue through GitHub](https://github.com/cloudinary/cloudinary_gem/issues).
43
172
 
44
- For documetation about Ruby on Rails integration see:
45
- http://cloudinary.com/documentation/rails_integration
173
+ Contact us at [info@cloudinary.com](mailto:info@cloudinary.com)
46
174
 
175
+ Or via Twitter: [@cloudinary](https://twitter.com/#!/cloudinary)
47
176
 
48
177
  ## License #######################################################################
49
178
 
@@ -4,13 +4,13 @@ require 'set'
4
4
  class Cloudinary::Static
5
5
  IGNORE_FILES = [".svn", "CVS", "RCS", ".git", ".hg"]
6
6
  SUPPORTED_IMAGES = [/\.gif$/i, /\.jpe?g$/i, /\.png$/i, /\.bmp$/i, /\.ico$/i]
7
- STATIC_IMAGE_DIRS = ["app/assets/images", "public/images"]
7
+ STATIC_IMAGE_DIRS = ["app/assets/images", "lib/assets/images", "vendor/assets/images", "public/images"]
8
8
  METADATA_FILE = ".cloudinary.static"
9
9
  METADATA_TRASH_FILE = ".cloudinary.static.trash"
10
10
 
11
11
  def self.discover
12
12
  ignore_files = Cloudinary.config.ignore_files || IGNORE_FILES
13
- relative_dirs = Cloudinary.config.statis_image_dirs || STATIC_IMAGE_DIRS
13
+ relative_dirs = Cloudinary.config.static_image_dirs || STATIC_IMAGE_DIRS
14
14
  dirs = relative_dirs.map{|dir| self.root.join(dir)}.select(&:exist?)
15
15
  dirs.each do
16
16
  |dir|
@@ -1,4 +1,4 @@
1
1
  # Copyright Cloudinary
2
2
  module Cloudinary
3
- VERSION = "1.0.18"
3
+ VERSION = "1.0.19"
4
4
  end
metadata CHANGED
@@ -2,7 +2,7 @@
2
2
  name: cloudinary
3
3
  version: !ruby/object:Gem::Version
4
4
  prerelease:
5
- version: 1.0.18
5
+ version: 1.0.19
6
6
  platform: ruby
7
7
  authors:
8
8
  - Nadav Soferman
@@ -12,7 +12,7 @@ autorequire:
12
12
  bindir: bin
13
13
  cert_chain: []
14
14
 
15
- date: 2012-05-02 00:00:00 +03:00
15
+ date: 2012-05-03 00:00:00 +03:00
16
16
  default_executable:
17
17
  dependencies:
18
18
  - !ruby/object:Gem::Dependency