1. Go to this page and download the library: Download falmar/eimage 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/ */
falmar / eimage example snippets
use eImage\eImage;
use eImage\eImageException;
/** Upload your image **/
$File = (isset($_FILES['img'])) ? $_FILES['img'] : null;
--------------- */
/**
* The next code will do the following:
* Rename the image to my_new_image.
* Place the uploaded image into base_dir/Images/
* Create a new unique image if find an existing one.
* return an array with the new image properties.
*/
$Image = new eImage([
'NewName' => 'my_new_name',
'UploadTo' => 'Images/',
'Duplicates' => 'u',
'ReturnType' => 'array'
]);
$Image->upload($File);
} catch (eImageException $e){
/** do something **/
}
use eImage\eImage;
use eImage\eImageException;
/** Upload your image **/
$File = (isset($_FILES['img'])) ? $_FILES['img'] : null;
);
/** -------------------------------------------------- */
/**
* Crop from source file
*/
$Image->set([
'Source' => 'path_to_your_file.jpg',
'Prefix' => 'AfterCrop-'
]);
$Image->crop(250, 250, -50, -75);
} catch (eImageException $e){
/** do something **/
}