PHP code example of reliqarts / laravel-guided-image
1. Go to this page and download the library: Download reliqarts/laravel-guided-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/ */
reliqarts / laravel-guided-image example snippets
use Illuminate\Database\Eloquent\Model;
use ReliqArts\GuidedImage\Concern\Guided;
use ReliqArts\GuidedImage\Contract\GuidedImage;
class Image extends Model implements GuidedImage
{
use Guided;
// ... properties and methods
}
use ReliqArts\GuidedImage\Contract\ImageGuide;
use ReliqArts\GuidedImage\Concern\Guide;
class ImageController extends Controller implements ImageGuide
{
use Guide;
}
$oldImage->remove($force);
// resized image:
$linkToImage = $image->routeResized([
'550', // width
'_', // height, 'null' is OK
'_', // keep aspect ratio? true by default, 'null' is OK
'_', // allow upsize? false by default, 'null' is OK
]);
// thumbnail:
$linkToImage = $image->routeThumbnail([
'crop', // method: crop|fit
'550', // width
'_', // height
]);