我尝试过:
$url = str_replace(' ', '%20', trim($url));
$percent = 1.0;
$imagethumbsize = 200;
header('Content-type: image/jpeg');
list($width, $height) = getimagesize($url);
$new_width = $width * $percent;
$new_height = $height * $percent;
$image_p = imagecreatetruecolor($imagethumbsize , $imagethumbsize);
$image = imagecreatefromjpeg($url);
imagecopyresampled($image_p, $image, -($new_width/2) + ($imagethumbsize/2), -($new_height/2) + ($imagethumbsize/2), 0, 0, $new_width , $new_width , $width, $height);
$hel=imagejpeg($image_p,"E:".DS."xampp".DS."htdocs".DS."opg-uat".DS."img".DS."c".DS , 100);
我得到的错误:"无法保存此图像,因为它包含错误"有人帮忙。
删除
if($hel)
echo 'Image saved';
从您的代码中。这是一个图像,但你正在将文本内容写入它。
尝试在错误时记录.log或将其放在 php 文件的顶部:
error_reporting(E_ALL);
ini_set('display_errors', '1');
它将显示所有错误。