miqoo1996 / imagemiq
An image upload package which provides lot of functions such as upload, resize, crop, rotate, delete.
1.0.0
2020-04-22 20:16 UTC
Requires
- php: >=5.4.0
This package is auto-updated.
Last update: 2025-04-12 05:49:02 UTC
README
The package helps to work with images easier, provides many functions such as image uploading, resizing, cropping, rotating, deleting.
How to use
- composer require miqoo1996/imagemiq
- HTML code
<form action="" method="post" enctype="multipart/form-data">
Select image to upload:
<input type="file" name="fileToUpload" id="fileToUpload">
<input type="submit" value="Upload Image" name="submit">
</form>
- PHP code
$obj = new \miqoo1996\imagemiq\image();
/**
* Image types must be one of these.
*
* IMAGETYPE_PNG, IMAGETYPE_GIF, IMAGETYPE_JPEG
* Ex. you can use IMAGETYPE_PNG to convert the image from current format to PNG.
*/
$obj->load($_FILES['fileToUpload']['tmp_name'])
->resizeToWidth(500)
->save('destination/aaa.png', IMAGETYPE_PNG);
// Some additional methods may come in handy, follow the below examples.
$obj->load($_FILES['fileToUpload']['tmp_name']); // Or $obj->load('image/from/path.jpg');
$obj->scale(2); // new image resized by scaling
$obj->resize(10, 20) // resize the image by the specific width and height
$with = $obj->getWidth();
$height = $obj->getHeight();
Enjoy coding with the nice package!