Tushar Kesarwani
Tushar Kesarwani

Reputation: 77

php_network_getaddresses: getaddrinfo failed

I am getting this error in all the functions of Image GD library. 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);


?>

The files are available at their place,

Code was working fine but now it is not working. I don't know wyy it is not working now..

Upvotes: 2

Views: 16987

Answers (3)

Tushar Kesarwani
Tushar Kesarwani

Reputation: 77

The problem is solved, it just needed a apache restart.

Upvotes: 0

Mercy
Mercy

Reputation: 641

Restarting apache server also resolved my issue. I recently moved to a dedicated server so there were some initial DNS issues.

Upvotes: 1

Jon Lin
Jon Lin

Reputation: 143866

The server that is running this code has DNS servers which it uses to resolve domain names, in this case, graph.facebook.com. It's either that those DNS servers are down or the server is misconfigured and can't reach whatever DNS servers it's supposed to use.

Upvotes: 1

Related Questions