6.0.0-git
2024-10-31
Last Modified 2005-06-03 by Guest

Here some javascript the code that will load an error image

ie (right mouse to save and put in the klutz/graphics/ folder)

file not found

Put this in common-header.inc
Please use the image preload from horde framework if there is one

<script language="javascript" type="text/javascript">
<!--
function imageNotFound(img){
    document.getElementById(img.id).src="<?php echo $registry->getParam 'webroot', 'horde') ?>/klutz/graphics/FileNotFound.gif";

}
// dreamwever preload replace with call to horde version
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length;i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}
MM_preloadImages("<?php echo $registry->getParam('webroot', 'horde')?>/klutz/graphics/FileNotFound.gif")
//-->
</script>

and the change in comic.inc ( look for the - and + )

<table border="0" cellpadding="1" cellspacing="0">
 <tr>
  <td align="left" class="header">
<?php if (!empty($homepage)): ?>
   <a href="<?php echo $homepage; ?>" target="_blank" class="header">
    <?php printf(_("%s by %s"), $name, $author) ?>
   </a>
<?php else: ?>
    <?php printf(_("%s by %s"), $name, $author) ?>
<?php endif; ?>
  </td>
  <td align="right" class="header"><span class="smallheader"><?php echo strftime("%B %d, %Y", $date) ?></span></td>
 </tr>
 <tr>
  <td colspan="2">
 
-  <img alt="<?php echo $name ?>" src="<?php echo $url ?>" <?php echo $size?> />

+   <img alt="<?php echo $name ?>" src="<?php echo $url ?>" <?php echo $size?> id="<?php echo $url ?>" onerror="imageNotFound(this);"/>

  </td>
 </tr>
</table>

I just used the url as the id I knew it would work but please replace with
better code

Paul Bearne