get imagex and imagey
Posted: Fri Jul 27, 2007 4:47 pm
I am trying to get the width and height of a remote image. I would like to do this without generating the image in GD because the user can upload any image [ gif, png, jpg...]and I really don't feel like writing a case for each image [ if png use imagecreatepng ]
I wrote this function, but it throws warnings:
Where banner is a remote image link. Here is the error i receive:
Thanks.
I wrote this function, but it throws warnings:
Code: Select all
function checkBanner($banner) {
$binary_data = file_get_contents($banner);
$im = imagecreatefromstring($binary_data);
$width = imagesx($im);
$height = imagesy($im);
if($width > 410){
return true;
}
else if($height > 70) {
return true;
}
return false;
}Any ideas what I'm doing wrong?Warning: file_get_contents() [function.file-get-contents]: php_network_getaddresses: getaddrinfo failed: Name or service not known in /var/www/toplist/register.php on line 144
Warning: file_get_contents(http://graphics.domain.com/link_banner/400x60.gif) [function.file-get-contents]: failed to open stream: No such file or directory in /var/www/toplist/register.php on line 144
Warning: imagecreatefromstring() [function.imagecreatefromstring]: Empty string or invalid image in /var/www/toplist/register.php on line 145
Warning: imagesx(): supplied argument is not a valid Image resource in /var/www/toplist/register.php on line 146
Warning: imagesy(): supplied argument is not a valid Image resource in /var/www/toplist/register.php on line 147
Thanks.