简体   繁体   中英

open and resize an image from a folder on the server in PHP and save it back

Is there anyway select an image from a folder inside the server, instead of submitting from HTML on a client side, and work on it using PHP? Then I want to resize the image and save as a different name to the same folder on the server. This gonna be by clicking a button from client side.

You can use this class .

// get image for manipulate from temp folder
$image = new Image($sourcePath);
// manipulate
$image->resize($targetWidth, $targetHeight, Image::AUTO)->sharpen(1)->quality(95)->save($resultPath);

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM