Jump to content


This topic is now archived and is closed to further replies.


Show if image exists

Recommended Posts

$color = poop;
$species = aisha;
$url = "http://images.neopets.com/pets/".$species."_".$color."_baby.gif";
if(!is_readable($url)) {
$size = getimagesize("$url");
$width = $size[0];
if($width == "150") {
echo "<img src='$url'>";

[i]Warning: getimagesize(http://images.neopets.com/pets/aisha_poop_baby.gif) [function.getimagesize]: failed to open stream: HTTP request failed! HTTP/1.1 404 Not Found in /fpgs/fpgshttpd/majestic-neo/pet_db/pets.php on line 6[/i]

I want the script to find out if the image really does exist then if it does it will show the image. But if the image doesn't exist then it will show nothing. Xould someone please tell me what I am doing wrong.

Share this post

Link to post
Share on other sites
cause getimagesize doesn't use http protocol, it uses folder strucure:


c:\path\to\image\ (Windows)
or /path/to/image (Nix)

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.