[klutz] Patch to show alternative image if comic does not exist.

Paul C paulc at mail4u.com.au
Sun Dec 21 21:33:09 PST 2003


Hi,

I've just done a quick and dirty patch to comics.php.  Basically it uses
file_get_contents to grab the image as a string and if it fails (404) it
loads in a nocomic.jpg image in its stead stopping the horrible red X's all
through the listing.

bash-2.05b# diff -c comics.php.old comics.php
*** comics.php.old      Mon Dec 22 15:06:57 2003
--- comics.php  Mon Dec 22 15:45:57 2003
***************
*** 99,104 ****
--- 99,107 ----
          header('Pragma:');
          print $image->data;
      } elseif (is_string($image) && substr($image, 0, 4) == 'http') {
+        if (! $fp = @fopen ($image, "r") ) {
+            $image = "/horde/klutz/graphics/nocomic.jpg";
+         }
          header("Location: $image");
          exit();
      } else {




More information about the klutz mailing list