0

I am trying to run the below code in w3schools try it php, but I get this error. what did I miss?

$file="https://www.w3schools.com/html/pic_trulli.jpg";
function resize_image($file, $w, $h, $crop=FALSE) {
    list($width, $height) = getimagesize($file);
    echo $width;
}
$w=100;
$h=100;
resize_image($file, $w, $h);

this is the error I get:

PHP Warning: getimagesize(): php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/j6Tv9z/prog.php on line 4 PHP Warning: getimagesize(https://www.w3schools.com/html/pic_trulli.jpg): failed to open stream: php_network_getaddresses: getaddrinfo failed: Temporary failure in name resolution in /home/j6Tv9z/prog.php on line 4

Professor Abronsius
  • 33,063
  • 5
  • 32
  • 46
kmboon
  • 21
  • 1
  • This works fine for me - unable to reproduce your error – Professor Abronsius Aug 10 '22 at 11:45
  • 3
    The error “Temporary failure in name resolution” generally means a DNS problem, and the “temporary” is either literal or “temporary until you fix something”. If you are using a third party service, don’t be surprised if they limit remote access for security/spam reasons. If this is local, see some solutions here: https://stackoverflow.com/q/6275535/231316 – Chris Haas Aug 10 '22 at 12:08
  • @Chris Haas Thanks. I put another image and it works fine. But for the previous photo it would return NAN to w/h. Maybe it's because the access thing? – kmboon Aug 11 '22 at 06:48

0 Answers0