PHP code example of themeplate / image

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

    

themeplate / image example snippets


use ThemePlate\Image;

Image::register( 'wanted_size', 1920, 1080 );
Image::manipulate( 'wanted_size', 'pixilate', 10 );

Image::register( 'another_size', 640, 480 );
Image::manipulate( 'another_size', 'greyscale' );
Image::manipulate( 'another_size', 'blur', 20 );

$processor = Image::processor();

$processor->report( function( $output ) {
    error_log( print_r( $output, true ) );
} );

// Simply use the core functions like you normally would
// - wp_get_attachment_image
// - wp_get_attachment_image_url
// - the_post_thumbnail
// - get_the_post_thumbnail
// - get_the_post_thumbnail_url