I have a php file that works like timthumb.php, which takes images from another site and creates a thumbnail with it. The problem is, if the image I'm trying to retrieve doesn't exist, I get a broken image. This file is used in a software I have on a site. My question is, does someone have a solution to the code below, that would allow me to show a default image if one isn't available? I would be forever indebted for you if you can help! <?php /************************************************************ Download Program ThumbNail Function ************************************************************/ $extension = end(explode(".", $_GET['filename'])); if($Size) {$filename=$filename."&Size=".$Size;} // Content type if ($extension == "gif") { header("Content-type: image/gif"); } elseif ($extension == "png") { header("Content-type: image/png"); } elseif ($extension == "jpg" || $extension == "jpeg") { header("Content-type: image/jpeg"); } // Get new dimensions list($width, $height) = getimagesize($filename); $ratio=$w/$width; $new_height = $height * $ratio; // Resample $image_p = imagecreatetruecolor($w, $new_height); if ($extension == "gif") { $image = imagecreatefromgif($filename); } elseif ($extension == "png") { $image = imagecreatefrompng($filename); } elseif ($extension == "jpg" || $extension == "jpeg") { $image = imagecreatefromjpeg($filename); } imagecopyresampled($image_p, $image, 0, 0, 0, 0, $w, $new_height, $width, $height); // Output imagejpeg($image_p, null, 100); ?> PHP: