在将图像存储在服务器上之前,我想使用以下类来调整图像的大小:https://www.verot.net/php_class_upload.htm?lang=en-GB
我将图像数据存储在编码为base64的MySQL表中。
到目前为止,我已经做到了:
$data = $myBase64DataFromDb;
//if (preg_match('/^data:image\/(\w+);base64,/', $data, $type)) {
// $data = substr($data, strpos($data, ',') + 1);
// $type = strtolower($type[1]); // jpg, png, gif
// $data = base64_decode($data);
$path = '/img/put/here/';
// $filename = $data.'.'.$type;
// $handle = new upload($filename);
$handle = new upload($data);
$handle->file_max_size = '5000000';
$handle->image_resize = true;
$handle->image_x = 600;
$handle->image_ratio_y = true;
$handle->process($path);
if ($handle->processed) {
echo $filename;
$handle->clean();
} else {
echo 'error : ' . $handle->error;
}
// }
我不断收到错误消息:
错误:文件未上传。无法进行处理。
我想念什么?