0

我正在拉新闻提要并在循环中执行批处理 imagecreatefromjpg() 但我收到了这个错误。

警告:imagecreatefromjpeg(): php_network_getaddresses: getaddrinfo failed: Name or service not known in /home4/index.php on line 90

当我只做一个图像时它工作正常,但在一个循环中,它会出错。每个图像是否应该有某种 onComplete 处理程序,也许它做得太快了?

我只是抓取每个提要图像的平均颜色。

$filename = $inimage;    
$image = imagecreatefromjpeg($filename);
$width = imagesx($image);
$height = imagesy($image);
$pixel = imagecreatetruecolor(1, 1);
imagecopyresampled($pixel, $image, 0, 0, 0, 0, 1, 1, $width, $height);
$rgb = imagecolorat($pixel, 0, 0);
$color = imagecolorsforindex($pixel, $rgb);
$image_r = $color['red'];
$image_g = $color['green'];
$image_b = $color['blue'];

谢谢。

4

0 回答 0