PHP code example of aileshe / thumb

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

    

aileshe / thumb example snippets


    $src = './public/upload/img_12.jpg'; // 原图路径
    $output = './public/upload/img_12_thumb.jpg'; // 输出保存文件名
    $width = 300; // 预生成缩略图的宽
    $height = 200; // 预生成缩略图的高
    \Thumb\Thumb::out($src,$output,$width,$height);

    $src = './public/upload/img_12.jpg'; // 原图路径
    $output = './public/upload/img_12_thumb.jpg'; // 输出保存文件名
    $width = 300; // 预生成缩略图的宽
    $height = 200; // 预生成缩略图的高
    \Thumb\Thumb::showOut($src,$output,$width,$height);