The Cloudinary PHP libraries are now available to your Cloud Functions. Cloudinary is a very powerful cloud tool to store, manage and manipulate your images in the cloud with a simple API call. You will be able to upload images directly to Cloudinary for manipulation or send the images you have already uploaded to your Cloud Database.
The Cloudinary API allow you to delegate heavy duty image manipulation work you would have to do on the smartphone itself to its powerful cloud systems. This will make your mobile application even more fluid and responsive and allow you to focus on the UI and interaction rather than complex image manipulation tasks.
Cloudinary isn’t only an image storage system. The list of features in terms of image manipulation is quite comprehensive. Resize, crop, transform, face detection, filters, overlays and more. Best of all you can chain them together to create your final transformed image in one simple API call.
Cloudinary also gives you the ability to extract profile pictures from your users’ social media account and resize them appropriately for your application in one call.
Follow the Cloudinary PHP guide to get the best out of their awesome service through your Cloud Functions. The Cloudinary objects are automatically available in your Cloud Functions and there is no need to execute import commands.
// Set the cloudinary object configuration \Cloudinary::config(array( "cloud_name" => "sample", "api_key" => "874837483274837", "api_secret" => "a676b67565c6767a6767d6767f676fe1" )); // upload an image \Cloudinary\Uploader::upload( // use the get_cloudbase_file function with the application code // (the cb_app_code always exists in your $params) and the file id // from your cloud database get_cloudbase_file($params["cb_app_code"], $file_id), array( "public_id" => "sample_id", "crop" => "limit", "width" => "2000", "height" => "2000", "eager" => array( array( "width" => 200, "height" => 200, "crop" => "thumb", "gravity" => "face", "radius" => 20, "effect" => "sepia" ), array( "width" => 100, "height" => 150, "crop" => "fit", "format" => "png" ) ), "tags" => array( "special", "for_homepage" ) ) ); // return to your application the url of a manipulated image return cloudinary_url("sample_id", array("resource_type" => "raw"));
Keep building awesome apps!
The post Cloudinary image manipulation from your Cloud Functions appeared first on Cloudbase.io Blog.