2017 © Pedro Peláez
 

symfony-bundle cloudinary-bundle

Cloudinary Wrapper

image

misteio/cloudinary-bundle

Cloudinary Wrapper

  • Tuesday, February 20, 2018
  • by MisteIO
  • Repository
  • 2 Watchers
  • 9 Stars
  • 10,117 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 5 Forks
  • 0 Open issues
  • 3 Versions
  • 39 % Grown

The README.md

MisteioCloudinaryBundle

Latest Stable Version Latest Unstable Version License Build Status Code Climate, (*1)

MisteioCloudinaryBundle is a Symfony2/3 Bundle forked from laravel4-cloudinary (thanks Teeplus) and cloudinary-bundle (thanks Speicher210). You can use it as a service, and some extends are implemented for Twig. Cloudinary Library v1.7.1., (*2)

Install

Via Composer, (*3)

``` bash $ composer require misteio/cloudinary-bundle, (*4)

or in composer.json file
``` bash
"misteio/cloudinary-bundle": "dev-master"

Register the bundle in app/AppKernel.php:, (*5)

``` php public function registerBundles() { return array( // ... new Misteio\CloudinaryBundle\MisteioCloudinaryBundle(), // ... ); }, (*6)


Configuration ------------- Configure the connection to cloudinary in your `config.yml` : ``` yaml misteio_cloudinary: cloud_name: yourCloudRegistrationName api_key: yourApiKey secret_key: yourSecretApiKey

Usage

This wrapper api provide simple methods to upload, rename, delete, tag manage and full features from original cloudinary class methods. You can use it via Dependency Injection Component(DIC) service., (*7)

    $cloudinary = $this -> container -> get('misteio_cloudinary_wrapper');

Upload Image, (*8)

    $cloudinary -> upload('path/to/file', 'name', $tags, $options)

Upload Video (Latest argument is for large files), (*9)

    $cloudinary -> uploadVideo('path/to/file', 'name', $tags, true)

Display an image, (*10)

    $cloudinary -> show('public_name', array('width' => 150, 'height' => 150, 'crop' => 'fit', 'radius' => 20));

Display an image using HTTPS, (*11)

  $cloudinary -> show('public_name', array('width' => 150, 'height' => 150, 'crop' => 'fit', 'radius' => 20, 'secure' => true));

Display a video, (*12)

    $cloudinary -> showVideo('public_name', array('width' => 150, 'height' => 150, 'crop' => 'fit', 'radius' => 20));

Display a video using HTTPS, (*13)

  $cloudinary -> showVideo('public_name', array('width' => 150, 'height' => 150, 'crop' => 'fit', 'radius' => 20, 'secure' => true));

More document from cloudinary.com, (*14)

Rename file, (*15)

    $cloudinary -> rename('from_public_id', 'to_public_id');

Delete file, (*16)

    $cloudinary -> destroy('public_id');

Manage with tag, (*17)

    $cloudinary -> addTag('my_tag_1', array('my_public_id', 'my_public_id_2'));
    $cloudinary -> removeTag('my_tag_2', array('my_public_id', 'my_public_id_2'));
    $cloudinary -> replaceTag('my_tag_3', array('my_public_id', 'public_id_2'));

Twig for displaying image

    {{ 'my_public_id'|cloudinary_url({"width" : 150, "height" : 150, "crop" : "fill", "radius" : 20}) }}

Twig for displaying image using HTTPS

  {{ 'my_public_id'|cloudinary_url({"width" : 150, "height" : 150, "crop" : "fill", "radius" : 20, "secure" : true}) }}

Twig for displaying video

    {{ 'my_public_id'|cloudinary_url_video({"width" : 150, "height" : 150, "crop" : "fill", "radius" : 20}) }}

Twig for displaying video using HTTPS

  {{ 'my_public_id'|cloudinary_url_video({"width" : 150, "height" : 150, "crop" : "fill", "radius" : 20, "secure" : true}) }}

Security

If you discover a security vulnerability , please email instead of using the issue tracker. All security vulnerabilities will be promptly addressed., (*18)

License

This Wrapper is open-sourced software licensed under the MIT license, (*19)

The Versions