1) Script Title: jQuery Image Magnify v1.11

2) Script URL (on DD): http://www.dynamicdrive.com/dynamici...agemagnify.htm

3) Describe problem: Am a total newbie and fumbling my way around an application that I was left with in an unfinished state by my programer which basically allows users to upload images and manage a property (holiday flats). The images themselves are stored on the filesytem together with references to a Mysql db.

The display on the users page is created by the following code

PHP Code:
makegallery$files,71008050); 
. There are two other files, one called makegallery and the other makepicfit. The script that generates the actual images from the file system is in makegallery.php and looks like this

PHP Code:
function makegallery($files$cols$mode$w$h
{

echo 
"
    <table width=\"100%\" border=\"0\" cellpadding=\"3\" cellspacing=\"0\">"
;
    
$count 0;
    
    foreach( 
$files as $file ) {
    
            if( 
$count $cols == )   echo "</tr>\n<tr>\n";
            if( 
$mode == ) { 
              if( 
substr($file,strlen($file)-3,3) == "gif" || 
substr($file,strlen($file)-3,3) == "jpg" || substr($file,strlen($file)-3,3) == 
"png" || substr($file,strlen($file)-4,4) == "jpeg") echo "<td align=\"center\" 
valign=\"middle\"><a href=\"/res/venuepics/"
.$file."\" target=\"_blank\"><img 
src=\"/res/makepicfit.php?file="
.$file."&w=".$w."&h=".$h."\" style=\"border: 
1px solid #BBBBBB\"></a></td>\n"
;
            }
            else {
              if( 
substr($file,strlen($file)-3,3) == "gif" || 
substr($file,strlen($file)-3,3) == "jpg" || substr($file,strlen($file)-3,3) == 
"png" || substr($file,strlen($file)-4,4) == "jpeg") echo "<td align=\"center\" 
valign=\"middle\"><img 
src=\"/res/makepicfit.php?file="
.$file."&w=".$w."&h=".$h."\" style=\"border: 1px 
solid #BBBBBB; cursor:pointer;\" onClick=\"if( this.style.border == '#bbbbbb 
1px solid' ) {this.style.border = '2px solid #FF0000';} else {this.style.border 
= '#bbbbbb 1px solid';} \"></td>\n"
;
            }
            
            
$count++;
    }
    
  echo 
"</table>";

The other file, makepicfit.php has this code in it

PHP Code:
<?php
$baseroot 
"venuepics/";  
$mod "";
$mod $_GET['mod'];
$cache "";
$cache $_GET['cache'];
$w $_GET['w'];
$h $_GET['h'];
$file $baseroot.$_GET['file'];
$ext substr($filestrlen($file)-33);

@
$srcImg imagecreatefromjpeg($file);
if (
$srcImg == "") @$srcImg imagecreatefromgif($file);
if (
$srcImg == "") @$srcImg imagecreatefrompng($file);

// create a (blank) smaller image object
$srcSize getimagesize($file);


//echo $file." ".$srcSize[0]."  ".$srcSize[1];

//width > height
if( $srcSize[0] > $srcSize[1] ) {
  
$ratio $srcSize[0] / $srcSize[1];
  
$d[0] = $w;
  
$d[1] = ceil($w/$ratio);
  
  if( 
$d[1] > $h ) {
    
$ratio $srcSize[0] / $srcSize[1];
    
$d[0] = ceil($h $ratio);
    
$d[1] = $h;
  }
//  protect against not specifying dimensions
  
if( $w == "" || $h == "" ) { $d[0] = $srcSize[0]; $d[1] = $srcSize[1]; }
  
$dstImg imagecreatetruecolor$d[0], $d[1] );
  }
else
  {
  
$ratio $srcSize[0] / $srcSize[1];
  
$d[0] = ceil($h $ratio);
  
$d[1] = $h;

  if( 
$d[0] > $w ) {
    
$ratio $srcSize[0] / $srcSize[1];
    
$d[0] = $w;
    
$d[1] = ceil($w/$ratio);
  }

//  protect against not specifying dimensions
  
if( $w == "" || $h == "" ) { $d[0] = $srcSize[0]; $d[1] = $srcSize[1]; }
  
$dstImg imagecreatetruecolor($d[0], $d[1]);
  }
  

// copy and resize from the source image object to the smaller blank one
imagecopyresized($dstImg$srcImg0000,
                  
$d[0], $d[1],
                  
$srcSize[0], $srcSize[1]);

 if( 
$mod=="sepia" ) {
   
imagetruecolortopalette($dstImg1256);    
   for( 
$i=0$i<imagecolorstotal$dstImg ); $i++ ) {
    
$c ImageColorsForIndex$dstImg$i );
    
$t = ($c["red"]+$c["green"]+$c["blue"])/3;
    
$nr $t;
    
$ng = ($t 20 $t-20 $t);
    
$nb = ($t 50 $t-50 $t);
    
imagecolorset$dstImg$i$nr$ng$nb );    
   }
  }


 if( 
$mod=="colorize" ) {
   
$r hexdec(substr($usecolor0,2));
   
$g hexdec(substr($usecolor2,2));
   
$b hexdec(substr($usecolor4,2));
   
   
imagetruecolortopalette($dstImg1256);    
   for( 
$i=0$i<imagecolorstotal$dstImg ); $i++ ) {
    
$c ImageColorsForIndex$dstImg$i );
    
$t = ($c["red"]+$c["green"]+$c["blue"])/3;
    
$nr min((0.8 $t) + (0.5$r), 255);
    
$ng min((0.8 $t) + (0.5$g), 255);
    
$nb min((0.8 $t) + (0.5$b), 255);
    
imagecolorset$dstImg$i$nr$ng$nb );    
   }
  }


 if( 
$mod=="grey" ) {
   
imagetruecolortopalette($dstImg1256);    
   for( 
$i=0$i<imagecolorstotal$dstImg ); $i++ ) {
    
$c ImageColorsForIndex$dstImg$i );
    
$t = ($c["red"]+$c["green"]+$c["blue"])/3;
    
imagecolorset$dstImg$i$t$t$t );    
   }
  }

if( 
$cache == '1' ) {
  
header("Expires: Sat, 1 Jan 2000 00:00:00 GMT");
  
header("Last-Modified: " gmdate("D, d M Y H:i:s") . " GMT");
  
header("Cache-Control: no-store, no-cache, must-revalidate");
  
header("Cache-Control: post-check=0, pre-check=0"false);
  
header("Pragma: no-cache");
}
header("Content-Type: image/jpeg");
imagejpeg($dstImg""75);

?>
I have been trying to use the magnifyer and trying various locations to insert the magnifyer class but an not getting anywhere at all. I am hoping one of you boffins can point me in the right direction and am not even sure if I have given enough information here for anyone to do so...I can get it to work on static images but as my images are generated dynamically with different image names as they are added and deleted I am now totally stumped and will really appreciate any help...
best regards