PHPackages                             unicodeveloper/laravel-cloudinary - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [File &amp; Storage](/categories/file-storage)
4. /
5. unicodeveloper/laravel-cloudinary

Abandoned → [cloudinary-labs/cloudinary-laravel](/?search=cloudinary-labs%2Fcloudinary-laravel)ArchivedLibrary[File &amp; Storage](/categories/file-storage)

unicodeveloper/laravel-cloudinary
=================================

A Laravel Cloudinary Package

1.0.0-beta6(5y ago)468.8k8MITPHPPHP ^7.0

Since Jun 15Pushed 5y ago1 watchersCompare

[ Source](https://github.com/unicodeveloper/laravel-cloudinary)[ Packagist](https://packagist.org/packages/unicodeveloper/laravel-cloudinary)[ Docs](https://github.com/unicodeveloper/laravel-cloudinary)[ RSS](/packages/unicodeveloper-laravel-cloudinary/feed)WikiDiscussions master Synced 3w ago

READMEChangelog (6)Dependencies (6)Versions (7)Used By (0)

 Laravel Cloudinary (DEPRECATED)
=================================

[](#-laravel-cloudinary-deprecated-)

 Please use the comprehensive =&gt; [ Cloudinary Laravel Package Now!](https://github.com/cloudinary-labs/cloudinary-laravel)
-----------------------------------------------------------------------------------------------------------------------------

[](#-please-use-the-comprehensive---cloudinary-laravel-package-now)

 [ ![Total Downloads](https://camo.githubusercontent.com/f6aab92dcd8261aa49aa16540557aeda30e7db7a44d68b5044b622773e8fa85a/68747470733a2f2f696d672e736869656c64732e696f2f7061636b61676973742f64742f756e69636f646576656c6f7065722f6c61726176656c2d636c6f7564696e6172792e7376673f7374796c653d666c61742d737175617265) ](https://packagist.org/packages/unicodeveloper/laravel-cloudinary) [ ![Latest Stable Version](https://camo.githubusercontent.com/dc04abda688bcde147e440b5ebc7602ef0ba4825428258618d3c65313e0b7abb/68747470733a2f2f706f7365722e707567782e6f72672f756e69636f646576656c6f7065722f6c61726176656c2d636c6f7564696e6172792f762f737461626c652e737667) ](https://packagist.org/packages/unicodeveloper/laravel-cloudinary) [ ![License](https://camo.githubusercontent.com/d5f687a94d18476aa9d6038146039ab45131e73c0bf787de82ea384cbdcba17b/68747470733a2f2f706f7365722e707567782e6f72672f756e69636f646576656c6f7065722f6c61726176656c2d636c6f7564696e6172792f6c6963656e73652e737667) ](https://packagist.org/packages/unicodeveloper/laravel-cloudinary)

> A Laravel Package for uploading, optimizing, transforming and delivering media files with Cloudinary. Furthermore, it provides a fluent and expressive API to easily attach your media files to Eloquent models.

Usage
-----

[](#usage)

**Upload** a file (*Image*, *Video* or any type of *File*) to **Cloudinary**:

```
/**
*  Using the Cloudinary Facade
*/

// Upload an Image File to Cloudinary with One line of Code
$uploadedFileUrl = Cloudinary::upload($request->file('file')->getRealPath())->getSecurePath();

// Upload a Video File to Cloudinary with One line of Code
$uploadedFileUrl = Cloudinary::uploadVideo($request->file('file')->getRealPath())->getSecurePath();

// Upload any File to Cloudinary with One line of Code
$uploadedFileUrl = Cloudinary::uploadFile($request->file('file')->getRealPath())->getSecurePath();

/**
 *  This package also exposes a helper function you can use if you are not a fan of Facades
 *  Shorter, expressive, fluent using the
 *  cloudinary() function
 */

// Upload an Image File to Cloudinary with One line of Code
$uploadedFileUrl = cloudinary()->upload($request->file('file')->getRealPath())->getSecurePath();

// Upload a Video File to Cloudinary with One line of Code
$uploadedFileUrl = cloudinary()->uploadVideo($request->file('file')->getRealPath())->getSecurePath();

// Upload any File to Cloudinary with One line of Code
$uploadedFileUrl = cloudinary()->uploadFile($request->file('file')->getRealPath())->getSecurePath();

/**
 *  You can also skip the Cloudinary Facade or helper method and laravel-ize your uploads by simply calling the
 *  storeOnCloudinary() method on the file itself
 */

// Store the uploaded file in the "lambogini" directory on Cloudinary
$result = $request->file('image')->store('lambogini', 'cloudinary');

// Store the uploaded file on Cloudinary
$result = $request->file('file')->storeOnCloudinary();

// Store the uploaded file on Cloudinary
$result = $request->file->storeOnCloudinary();

// Store the uploaded file in the "lambogini" directory on Cloudinary
$result = $request->file->storeOnCloudinary('lambogini');

// Store the uploaded file in the "lambogini" directory on Cloudinary with the filename "prosper"
$result = $request->file->storeOnCloudinaryAs('lambogini', 'prosper');

$result->getPath(); // Get the url of the uploaded file; http
$result->getSecurePath(); // Get the url of the uploaded file; https
$result->getSize(); // Get the size of the uploaded file in bytes
$result->getReadableSize(); // Get the size of the uploaded file in bytes, megabytes, gigabytes or terabytes. E.g 1.8 MB
$result->getFileType(); // Get the type of the uploaded file
$result->getFileName(); // Get the file name of the uploaded file
$result->getOriginalFileName(); // Get the file name of the file before it was uploaded to Cloudinary
$result->getPublicId(); // Get the public_id of the uploaded file
$result->getExtension(); // Get the extension of the uploaded file
$result->getWidth(); // Get the width of the uploaded file
$result->getHeight(); // Get the height of the uploaded file
$result->getTimeUploaded(); // Get the time the file was uploaded
```

**Attach Files to Laravel Eloquent Models**:

First, import the `Unicodeveloper\Cloudinary\MediaAlly` trait into your Model like so:

```
