PHP code example of visuellverstehen / statamic-picturesque

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

    

visuellverstehen / statamic-picturesque example snippets


use VV\Picturesque\Picturesque;

// ...

public function makePicture(string $imageUrl)
{   
    return (new Picturesque($imageUrl))
        ->default('300 | 1.5:1')
        ->breakpoint('md', '1024 | 1.6:1')
        ->breakpoint('lg', '1280 | 2:1 | 960px')
        ->format(['webp', 'jpg'])
        ->glideParams([
            'blur' => 10,
            'quality' => 85,
            'fit' => 'contain',
            'bg' => 'ffffff'
        ])
        ->alt('A huge billboard that says ›I wish everyone would care about alt texts.‹')
        ->class('w-full object-cover')
        ->lazy(true)
        ->generate() // you always have to call this!
        ->html(); // or ->json()
}