简体   繁体   English

使用PHP在服务器上的文件夹中打开图像并调整其大小,然后将其保存回来

[英]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? 无论如何,是否有必要从服务器内部的文件夹中选择图像,而不是从客户端的HTML提交图像,然后使用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);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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