PHP code example of rik43 / imagecache

1. Go to this page and download the library: Download rik43/imagecache 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/ */

    

rik43 / imagecache example snippets


'Intervention\Image\ImageServiceProvider',
'Devfactory\Imagecache\ImagecacheServiceProvider',

'Imagecache'      => 'Devfactory\Imagecache\Facades\ImagecacheFacade',



return array(
  'teaser' => array(
    'width' => 150,
    'height' => 100,
    'method' => 'crop',
  ),
  '465x320' => array(
    'width' => 465,
    'height' => 320,
    'method' => 'resize',
    'background_color' => '#FFFFFF',
  ),
);

$image = Imagecache::get('images/sunset.jpg', 'teaser');
echo $image->img;
echo '<img src="'. $image->src .'">

// Directly in a blade template
{{ Imagecache::get('uploads/images/sunset.jpg', 'teaser')->img }}

{!! Imagecache::get('uploads/images/sunset.jpg', 'teaser')->img !!}