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.
package MyWebApp; use Mojo::Base 'Mojolicious'; sub startup { my $self = shift; $self->plugin('Mojolicious::Plugin::Cloudinary', { cloud_name => $str, api_key => $str, api_secret => $str, }); } package MyWebApp::SomeController; sub upload { my $self = shift; $self->render_later; Mojo::IOLoop->delay( sub { my($delay) = @_; $self->cloudinary_upload( { file => $self->param('upload_param'), }, $delay->begin, ); }, sub { my($delay, $res, $tx) = @_; return $self->render(json => $res) if $res; return $self->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.
See Cloudinary.
Jan Henning Thorsen - jhthorsen@cpan.org
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.