PHP code example of gnahotelsolutions / image-cacher
1. Go to this page and download the library: Download gnahotelsolutions/image-cacher 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/ */
gnahotelsolutions / image-cacher example snippets
use GNAHotelSolutions\ImageCacher\Cacher;
use GNAHotelSolutions\ImageCacher\Image;
// Image located in public/img/hotel/rooms/double-room.jpg
$image = new Image('hotel/rooms/double-room.jpg', 'img');
$resized = (new Cacher())->resize($image, 1920, 1080); // Get a smaller version of the image or the same if the size is smaller.
$cropped = (new Cacher())->crop($image, 1920, 1080); // Get a cropped version of the image.
$cacher = new Cacher();
$image = new Image('hotel/rooms/double-room.jpg', 'img');
$cacher = new Cacher();
$image = new Image('hotel/rooms/double-room.jpg', 'img');