PHP code example of mvccore / ext-tool-image

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

    

mvccore / ext-tool-image example snippets


Image	Image::AddOverlay($overlayImgFullPath, $x, $y, $alpha, $composite); // Adding overlay image is not implemented for Gd adapter
Image	Image::ApplyMask($maskImgFullPath);
Image	Image::Contain($width, $height);
Image	Image::Cover($width, $height, $orientation);
Image	Image::CreateEmptyImageResource($width, $height, $hexBgColor = 'transparent');
Image	Image::Crop($x, $y, $width, $height);
Image	Image::CropPercent($xPercentage, $yPercentage, $widthPercentage, $heightPercentage);
Image	Image::Frame($width, $height);
int	Image::GetHeight();
int	Image::GetWidth();
Image	Image::Grayscale();
array	Image::HexColor2RgbArrayColor($hexColor);
bool	Image::IsVectorGraphic();
Image	Image::Load($imgFullPath);
Image	Image::Resize($width, $height);
Image	Image::ResizeByHeight($height);
Image	Image::ResizeByPixelsCount($count);
Image	Image::ResizeByWidth($width);
Image	Image::Rotate($angle);
Image	Image::RoundCorners($x, $y);
Image	Image::Sepia($threshold = 80);
Image	Image::SetBackgroundColor($hexColor);
Image	Image::SetBackgroundImage($bgImgFullPath);
Image	Image::Save($imgFullPath, $format, $quality);
Image	Image::UnsharpMask($amount, $radius, $threshold);



MvcCore\Ext\Tools;

// resize `source.jpg` to `thumb.jpg`:
$image = Tools\Image::CreateInstance()
    ->Load(__DIR__ . "/source.jpg")
    ->ResizeByHeight(150)
    ->UnsharpMask(300, 0.7, 50)
    ->Save(
        __DIR__ . "/thumb.jpg",
        Tools\Images\IFormat::JPG,
        100
    );

// display original and resized image:
echo '<html><body>',
     '<img src="source.jpg" />',
     '<br />',
     '<img src="thumb.jpg" />',
     '</body></html>';