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

Marcus I. Ryan marcus at horde.org
Mon Dec 22 07:04:42 PST 2003


Unless someone can argue a better point I don't intend to apply this patch.

(1) It adds significant bandwidth load to both the Klutz server and the server
providing the images.  Now not only does the user fetch the image directly
from his client, but the server fetches each image on each page load just to
see if its there.  That's inefficient for the Klutz server and causes at
least two hits on the target server instead of one.

(2) If you want to get rid of the red X all you have to do is setup klutz to
use the file driver.  It will then display a nice "Comic is missing"
place-holder and, if you're an admin, a link to try to re-fetch the comic.

--
Marcus I. Ryan, marcus at horde.org
-----------------------------------------------------------------------
 "Love is a snowmobile racing across the tundra and then suddenly it
 flips over, pinning you underneath.  At night, the ice weasels come."
                 -- Matt Groening
-----------------------------------------------------------------------


Quoting Paul C <paulc at mail4u.com.au>:

> 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 {
>
>
>
> --
> klutz mailing list
> Frequently Asked Questions: http://horde.org/faq/
> To unsubscribe, mail: klutz-unsubscribe at lists.horde.org
>
>


----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.



More information about the klutz mailing list