PHP code example of rolandstarke / laravel-thumbnail

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

    

rolandstarke / laravel-thumbnail example snippets


<img src="{{ Thumbnail::src($path)->crop(64, 64)->url() }}" />



    //load image from dir
    \Thumbnail::src(public_path('images/example.jpeg'));

    //load image from Storage::disk('local')
    \Thumbnail::src('userimage.jpg', 'local' /* disk */);

    //load image from website
    \Thumbnail::src('https://picsum.photos/200');

php vendor/bin/phpunit
html
<img src="{{ Storage::disk('public')->url('desert.jpg') }}">
<!-- <img src="/storage/desert.jpg"> -->

<img src="{{ Thumbnail::src('desert.jpg', 'public')->smartcrop(200, 200)->url() }}">
<!-- <img src="/storage/jhf47.jpg?src=desert.jpg&smartcrop=200x200"> -->
bash
php artisan vendor:publish --tag=thumbnail-config
bash
php artisan thumbnail:purge