PHP code example of pionix-labs / glu-image

1. Go to this page and download the library: Download pionix-labs/glu-image 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/ */

    

pionix-labs / glu-image example snippets


'providers' => array(

	// ...
	'Intervention\Image\ImageServiceProvider',
	'PionixLabs\GluImage\GluImageServiceProvider',
),

'aliases' => array(

	// ...

	'GluImage' => 'PionixLabs\GluImage\Facades\GluImage',
),

'aliases' => array(

	// ...

	'InterImage' => 'Intervention\Image\Facades\Image',
),

$img = GluImage::get( $path_to_images.'/01.jpg' );
$img->resize(540,360);
$img->save( $path_to_images.'/01-resized.jpg' );

// ...

GluImage::get( $path_to_images.'/01.jpg' )->resize(540,360)->save( $path_to_images.'/01-resized.jpg' );

// ...

GluImage::get( $path_to_images.'/01.jpg' )->crop(540,360)->save( $path_to_images.'/01-cropped.jpg' );

// ...

// one chain creates two different files
GluImage::get( $path_to_images.'/01.jpg' )
	->resize(540,360)
	->save( $path_to_images.'/01-resized1.jpg' )
	->resize(360,220)
	->save( $path_to_images.'/01-resized2.jpg' );

// ...

// chaining another methods after save() method for animated gif files 
// is available only with forked version of GifCreator
GluImage::get( $path_to_images.'/01.gif' )
	->resize(540,360)
	->save( $path_to_images.'/01-resized.gif' )
	->crop(360,220)
	->save( $path_to_images.'/01-resized-and-cropped.gif' );