GithubHelp home page GithubHelp logo

cloudder's Introduction

Cloudder

Build Status License Latest Version Total Downloads

Cloudinary wrapper for Laravel 5

Initially forked from https://github.com/teepluss/laravel4-cloudinary. As it doesn't seem to be maintained anymore, and facing the lack of response from the original maitainer (issue opened + pull request opened, last commit on August last year), I decided to create a new fork that I plan on maintaining.

If there is any feature you would like feel free to open an issue or send me an email!

Installation

composer require jrm2k6/cloudder:0.2.*

For people still using Laravel 4.2: composer require jrm2k6/cloudder:0.1.* and check the branch l4 for the installation instructions.

Configuration

Modify your .env file to add the following information from Cloudinary

Required

CLOUDINARY_API_KEY=`your key`
CLOUDINARY_API_SECRET=`your secret`
CLOUDINARY_CLOUD_NAME=`your cloud name`

Optional

CLOUDINARY_BASE_URL
CLOUDINARY_SECURE_URL
CLOUDINARY_API_BASE_URL

Add the following in config/app.php:

'providers' => array(
  'JD\Cloudder\CloudderServiceProvider'
);

'aliases' => array(
  'Cloudder' => 'JD\Cloudder\Facades\Cloudder'
);

Run php artisan vendor:publish --provider="JD\Cloudder\CloudderServiceProvider"

Usage

Cloudder::upload($filename, $publicId, $options, $tags);

with:

  • filename: path to the image you want to upload
  • publicId: the id you want your picture to have on Cloudinary, leave it null to have Cloudinary generate a random id.
  • options: options for your uploaded image, check the Cloudinary documentation to know more
  • tags: tags for your image

returns the CloudinaryWrapper.

Cloudder::uploadVideo($filename, $publicId, $options, $tags);

with:

  • filename: path to the video you want to upload
  • publicId: the id you want your video to have on Cloudinary, leave it null to have Cloudinary generate a random id.
  • options: options for your uploaded video, check the Cloudinary documentation to know more
  • tags: tags for your image

returns the CloudinaryWrapper.

Cloudder::getPublicId()

returns the public id of the last uploaded resource.

Cloudder::getResult()

returns the result of the last uploaded resource

Cloudder::show($publicId, $options)
Cloudder::secureShow($publicId, $options)

with:

  • publicId: public id of the resource to display
  • options: options for your uploaded resource, check the Cloudinary documentation to know more

returns the url of the picture on Cloudinary (https url is secureShow is used).

Cloudder::showPrivateUrl($publicId, $format, $options)

with:

  • publicId: public id of the resource to display
  • format: format of the resource your want to display
  • options: options for your uploaded resource, check the Cloudinary documentation to know more

returns the private url of the picture on Cloudinary, expiring by default after an hour.

Cloudder::rename($publicId, $toPublicId, $options)

with:

  • publicId: publicId of the resource to rename
  • toPublicId: new public id of the resource
  • options: options for your uploaded resource, check the cloudinary documentation to know more

renames the original picture with the toPublicId id.

Cloudder::destroyImage($publicId, $options)
Cloudder::delete($publicId, $options)

with:

  • publicId: publicId of the resource to rename
  • options: options for your uploaded image, check the cloudinary documentation to know more

removes image from Cloudinary

Cloudder::destroyImages($publicIds, $options)

with:

  • publicIds: array of ids, identifying the pictures to remove
  • options: options for the images to delete, check the cloudinary documentation to know more

removes images from Cloudinary

Cloudder::addTag($tag, $publicIds, $options)

with:

  • tag: tag to apply
  • publicIds: images to apply tag to
  • options: options for your uploaded resource, check the cloudinary documentation to know more
Cloudder::removeTag($tag, $publicIds, $options)

with:

  • tag: tag to remove
  • publicIds: images to remove tag from
  • options: options for your uploaded image, check the Cloudinary documentation to know more
Cloudder::createArchive($options, $archiveName, $mode)

with:

  • options: options for your archive, like name, tag/prefix/public ids to select images
  • archiveName: name you want to give to your archive
  • mode: 'create' or 'download' ('create' will create an archive and returns a JSON response with the properties of the archive, 'download' will return the zip file for download)

creates a zip file on Cloudinary

Cloudder::downloadArchiveUrl($options, $archiveName)

with:

  • options: options for your archive, like name, tag/prefix/public ids to select images
  • archiveName: name you want to give to your archive

returns a download url for the newly created archive on Cloudinary

Running tests

phpunit

Example

You can find a working example in the repo cloudder-l5-example

cloudder's People

Contributors

jrm2k6 avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.