Skip to content

Using Cloudinary for Website Asset Management in the Cloud

When we conceived Cloudinary, our vision was to help with website asset management (images, Javascripts, CSS, etc.) in the cloud, easily and effectively. Our initial focus was on image management in the cloud since we’ve felt that this particular area was significantly underdeveloped. We figured that every web developer would be happy with a solid solution for image file uploads, applying image transformations in the Cloud and getting their website’s images delivered through a fast CDN.

We’ve recently taken the plunge and added support for raw file uploads and CDN delivery. In addition to images, you can now use Cloudinary’s same simple APIs and dynamic URLs to manage every file in the cloud – CSS, Javascript, PDF, and more. The advantages:

  • Simple API for uploading files to a safe cloud storage.
  • Strong integration with your development environment and model objects.
  • Simple access to managed files through dynamic URLs.
  • Fast, optimized CDN delivery (correct cache settings, etc.)
Uploaded files are stored in the cloud and immediately made accessible. As opposed to uploaded images, raw files are kept as-is and not transformed in any way (though we have cool ideas for time-saving transformations we can offer for these files). 
 
Here’s a quick example. Suppose you want to link to an Excel spreadsheet file from your website.
 
The following Ruby snippet will upload the XLS file to your Cloudinary account.
 
Cloudinary::Uploader.upload(“sample_spreadsheet.xls”, 
                                                   :public_id => “sample_spreadsheet”,
                                                   :resource_type => :raw)
 
Behind the scenes, the uploading is done through our RESTful API. See our documentation for more details.
 
Downloading the uploaded file is done using a simple dynamic URL:


Cloudinary also supports a single API endpoint for all kinds of files, using the ‘auto’ resource type. This is useful if you allow your visitors to upload files of arbitrary format, image or otherwise, to your web app.
The result of the API upload request includes the final URL the uploaded file is available at. For image files, you can add any image transformation parameters as in standard image uploading.
 
The URL for uploading files with automatic type detection (replace ‘demo’ with your cloud name):
 
https://api.cloudinary.com/v1_1/demo/auto/upload

And in Ruby on Rails use the following:

Cloudinary::Uploader.upload(“sample_document.pdf”, :resource_type => :auto)

Like most of our features, raw file uploading is available now for all free & paid plans. 

___

Back to top

Featured Post