Mojolicious::Plugin::Cloudinary - Talk with cloudinary.com
This register the methods from the Cloudinary module as helpers in your Mojolicious web application. See "HELPERS" for details.
use Mojolicious::Lite; plugin cloudinary => {cloud_name => $str, api_key => $str, api_secret => $str}; post "/upload" => sub { my $c = shift; $c->delay( sub { my ($delay) = @_; $c->cloudinary_upload({file => $c->param("upload_param")}, $delay->begin); }, sub { my ($delay, $res, $tx) = @_; return $c->render(json => $res) if $res; return $c->render_exception; }, ); }
This string will be used as the image src for images constructed by "cloudinary_js_image". The default is "/image/blank.png".
See "upload" in Cloudinary.
See "destroy" in Cloudinary.
See "url_for" in Cloudinary.
$str = $c->cloudinary_image($public_id, $url_for_args, $image_args);
This will use "image" in Mojolicious::Plugin::TagHelpers to create an image tag where "src" is set to a cloudinary image. $url_for_args are passed on to "url_for" and $image_args are passed on to "image" in Mojolicious::Plugin::TagHelpers.
$url_for_args
$image_args
$str = $c->cloudinary_js_image($public_id, $url_for_args);
About the same as "cloudinary_image", except it creates an image which can handled by the cloudinary jQuery plugin which you can read more about here: http://cloudinary.com/blog/cloudinary_s_jquery_library_for_embedding_and_transforming_images
Example usage:
$c->cloudinary_js_image(1234567890 => {width => 115, height => 115, crop => "thumb", gravity => "faces", radius => "20"});
...will produce:
<img src="/image/blank.png" class="cloudinary-js-image" alt="1234567890" data-src="1234567890" data-width="115" data-height="135" data-crop="thumb" data-gravity="faces" data-radius="20">
Note: The "class" and "alt" attributes are fixed for now.
Will register the "HELPERS" in the Mojolicious application.
Cloudinary.
To install Cloudinary, copy and paste the appropriate command in to your terminal.
cpanm
cpanm Cloudinary
CPAN shell
perl -MCPAN -e shell install Cloudinary
For more information on module installation, please visit the detailed CPAN module installation guide.