3) $pic = 'images/broken.gif'; $pic_no_spaces = eregi_replace('%20','',$pic); $pic_cached = eregi_replace($image->image_basedir,'',$pic_no_spaces); if ($_GET['check']=='phpinfo') { phpinfo(); } else { $allowed_extension = $image->allowed_extension($pic); if (isset($pic) && $thumbnail_width>0 && $allowed_extension) { /* check to see if file already exists in cache, and output it with no processing if it does */ $cached_filename = $image->set_cache_filename($pic_cached, $thumbnail_width, $is_square, $is_border); if (is_file($cached_filename)) /* display cached filename */ { header('Content-type: image/jpeg'); header('Location: ' . $cached_filename . '?' . rand(2,9999)); } else /* create new thumbnail, and add it into the cache directory as well */ { header('Content-type: image/jpeg'); $cache_output = $image->set_cache_filename($pic_cached, $thumbnail_width, $is_square, $is_border); $image->generate_thumb($pic, $thumbnail_width, $is_square, $is_border, $cache_output); header('Location: ' . $cache_output . '?' . rand(2,9999)); } } else if (!isset($pic)) { echo "ERROR: No image submitted"; } else if ($thumbnail_width<=0) { echo "ERROR: Invalid resizing option"; } else if (!$allowed_extension) { echo "ERROR: Prohibited file extension"; } } ?>