1. Go to this page and download the library: Download uginroot/image-resize 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/ */
$content = file_get_content($path);
$resource = imagecreatefromstring($content);
$image = new ImageCreate($resource, $content);
$image = new ImageCreate($resource); // $image->resetOrientation() not working
$image->cropEdge(50, ImageResize::SIDE_ALL);
// cropEdge(int $cutLength [, int $side = ImageResize::SIDE_ALL])
$image->addBorder(10);
// addBorder(int $borderWidth [, int $side = ImageResize::SIDE_ALL [, int $color = 0x000000]])
ImageResize::FIT_CANCEL; // cancel if wathermark size grate then $image
ImageResize::FIT_RESIZE; // resize wathermak
ImageResize::FIT_AS_IS; // crop if watermark out of bounds
$watermark = ImageResize::createFromPath($path);
$image->setWatermark($watermark);
// setWatermark(ImageResize $watermark [, int $position = ImageResize::POSITION_BOTTOM_RIGHT [, int $padding = 16 [, int $fit = ImageResize::FIT_AS_IS]]]);