php_network_getaddresses : getaddrinfo failed

标签 php gd

我在 Image GD 库的所有函数中都遇到此错误。 enter image description here

$im = @imagecreatefromjpeg("src/bg.jpg") or die('Cannot Initialize new GD image stream');
function copyImage1($im, $dp1_name, $x1, $y1){
    $dp1 = imagecreatefromjpeg($dp1_name);
    list($w1, $h1) = getimagesize($dp1_name);
    imagecopy($im, $dp1, 35, 130, 0, 0, $w1, $h1);
}
function copyImage2($im, $dp2_name, $x2, $y2){
    $dp2 = imagecreatefromjpeg($dp2_name);
    list($w2, $h2) = getimagesize($dp2_name);
    imagecopy($im, $dp2, 618, 125, 0, 0, $w2, $h2);
}

$box = imagettfbbox(30, 0, "src/font.ttf", $user_name);
imagettftext($im, 23, 0, 53, 348, imagecolorallocate($im, 73, 184, 227), "src/font.ttf", "hello");
imagettftext($im, 23, 0, 628, 348, imagecolorallocate($im, 73, 184, 227), "src/font.ttf", "byr");
copyImage1($im, "http://graph.facebook.com/100001504336690/picture?width=153&height=143", 10, 10);
copyImage2($im, "http://graph.facebook.com/100001504336690/picture?width=138&height=158", 10, 10);

$file_name = "dump/" . rand(1000, 9999) . "-id-" . rand(1000, 9999) . ".jpg"; 
imagejpeg($im, $file_name, 80);
imagedestroy($im);


?>

这些文件在其位置可用,

代码原本工作正常,但现在无法工作。我不知道为什么它现在不起作用..

最佳答案

运行此代码的服务器具有用于解析域名的 DNS 服务器,在本例中为 graph.facebook.com。要么是这些 DNS 服务器已关闭,要么是服务器配置错误,无法访问它应该使用的任何 DNS 服务器。

关于php_network_getaddresses : getaddrinfo failed,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/18885496/

相关文章:

php - 使用 Windows 主机上的 ASP.Net 表单更新 Linux 主机上的 MySQL 数据库的最有效方法是什么?

php - 错误 : check the manual [. ..] MySQL 服务器版本,以便在 ' 附近使用正确的语法

php gd 图像质量

PHP GD 内存使用率非常低 VS 非常高

php - 安装 GD Toolkit 时出错

php - 我可以用 php 7.2 安装 GD 库吗?

php - CodeIgniter - 无法访问与您的字段名称密码对应的错误消息。(pword_check)

php - 两个代码理论上是相同的,但实际上却是不同的……怎么可能

php - 使用 cron 作业为每个用户安排可变时间的每日通知

linux - 在 Linode 服务器 Debian 9 上为 php5.6 安装 GD 库时依赖关系中断