Cloudinary: A Friendlier Alternative to Amazon / Google Cloud Services
Cloud services are an incredible tool for web development. They allow you to safely, reliably store tons data on remote servers for your clients to access via your applications. They outsource much of the burden of managing file service, especially for large file types like images and videos.
The two most popular cloud service tools are S3 by Amazon, and gCloud by Google. They are both enormous, with sprawling documentation. Both lack clear, concise, minimal use examples. Their superior performance and security is paid for in usability and transparency.
If you have a small application that you don't need to scale by hundreds of thousands of hits, I absolutely recommend Cloudinary. Their documentation is elegant and straight-forward. It boasts many examples in basically every major web language.
If you're new to web development, and you'd rather spend time building your projects than learning the intricacies of some big corporate infrastructure, START WITH CLOUDINARY. Learn S3 or gCloud later, preferably on a team with other people who have already used it before, who can smooth out the early learning curve. Productive people focus their efforts where they know the least energy will produce the most results first. There is no reason to spend energy and time hitting your head against bad documentation, when there is so much else you can benefit from immediately.
It even has some amazing useful features that Google and Amazon don't offer. For example, suppose your users upload images from their iOS devices. Apple treats the EXIF data on those images in a quirky way. If your user snapped the photo with their phone sideways, that information is stored on the the image. That's normally no problem, but modern web-browsers consider that information when reading files. The result is that your user's iPhone images will all be stored and displayed with a -90° rotation. Like this:
Cloudinary lets you add parameters to your url query strings, that return transformed versions of the images it stores! Let's say the raw url of the photo above looks like this:
http://res.cloudinary.com/{{your cloudinary database name}}/image/upload/v1445973829/{{your file name}}.jpg
For iPhone images, that will result in the wonky behavior above. But you can instead just call a url that returns a transformed version of the same image! Like so:
http://res.cloudinary.com/{{your cloudinary database name}}/image/upload/a_exif/v1445973829/{{your file name}}.jpg
That will return a photo that rotates according to the EXIF data it has, which for iPhones means it will rotate upright! Alternatively, you could say:
http://res.cloudinary.com/{{your cloudinary database name}}/image/upload/a_0/v1445973829/{{your file name}}.jpg
"a" stands for "angle", and "exif" or "0" say "rotate it according to the exif" or "rotate it 0°", respectively. There are all sorts of cool helpful tricks that you will not (easily) find in the S3 or gCloud docs.
Happy building!
Post A Comment:
0 comments: