PHP code example of teamzac / cloudinary-url-builder

1. Go to this page and download the library: Download teamzac/cloudinary-url-builder library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

teamzac / cloudinary-url-builder example snippets


// in a service provider
	public function boot() 
	{
		Cloudinary::extend('my-preset', function() {
			return new MyPreset();
		});
	}

// in your application code
	$url = Cloudinary::preset('my-preset')->id('image.jpg')->getUrl();

// with just the main options
Cloudinary::id('image.jpg')
	->outline('inner', 5, 1000);

// with a callback as the first parameter. You'll receive an instance of TeamZac\Cloudinary\Transformations\PendingOutline
Cloudinary::id('image.jpg')
	->outline(function($outline) {
		$outline->mode('inner')
			->width(5)
			->color('orange');
	});

Cloudinary::id('image.jpg')
	->outline(function($outline) {
		$outline->mode('outer')
			->width(5)
			->color('rgb:30a940');
	});

// you can also use the Color class if you prefer
Cloudinary::id('image.jpg')
  ->outline(function($outline) {
    $outline->mode('outer')
      ->width(5)
      ->color(TeamZac\Cloudinary\Color::hex('30a940'));
  });

bash
php artisan vendor:publish
 php
Cloudinary::id('image.jpg')
	->resize(300, 450, 'crop')
	->removeRedEye()
	->sepia(30)
	->getUrl();
 php


namespace App\Presets;

use TeamZac\Cloudinary\Builder;

class MyPreset extends Builder 
{
	protected function initializePreset()
	{
		$this->resize(300, 450, 'crop')
			->removeRedEye()
			->sepia(30);
	}	
}