$value){ $$key=$value; } foreach ($_POST as $key=>$value){ $$key=$value; } ?> sortfile // (and then edit with vi) // ///////////////////////////////////////////////////////////////////////////// ?> Unique Histology of the Mouse

These images are from cross sections of the whole mouse and demonstrate
some of the unique anatomic and histologic features of the mouse. The whole slide images can be accessed by clicking here.

" ; // Title for the overall web page $marginsize = 300; // Size of left-hand frame with thumbnails $pagecolor = "#FFFFFF"; // Default background color of pages $textcolor = "#000000"; // Default text color for all pages $imagesize = true; // Resize images to fit window? true/false $thumb = "./thumb"; // Directory where thumbnails are stored $thumbquality = 90; // Thumbnail image quality, range 0 - 100 $guestcomment = true; // If true, then guests can leave comments $recentcount = 10; // How many 'recent' comments to show $introfile = "intro.html"; // If it exists, will be displayed up front $headerfile = "header.html"; // If it exists, will be included at top $footerfile = "footer.html"; // If it exists, will be included at bottom $sortfile = "sortfile"; // If it exists, contains filenames in order $imagemagick = true; // Are you using Imagemagick? true / false // If you ARE using Imagemagick, then define these: $im_identify = "c:\\Program Files\\Imagemagick\\identify.exe";// Path to the Imagemagick "identify" program $im_convert = "c:\\Program Files\\Imagemagick\\convert.exe"; // Path to the Imagemagick "convert" program // If you are NOT using Imagemagick, then this script will use a combination // of the GD library (compiled into your PHP) and libjpeg. You should define this: $getcomment = "";// To extract JPG comments (part of libjpeg) ////////////////////////////////////////////////////////////////////////////// ?> Check the configuration of this script and your server."); die; } } else if (!function_exists("ImageTypes")) { PrintHeader(); PrintError("Sorry, but this script requires access to an image library. You should either install Imagemagick (and then turn on the Imagemagick switch in this script), or make sure your copy of PHP has been compiled with native support for images.
configure --with-gd ..."); die; } function RemoveNewLines (&$item, $key) { $item = chop($item); } function GetFileList( $dirname="." ) { // Finds all the images // First check to see if there's a file called $sortfile // that contains a sorted list of filenames, one per line // otherwise, will default to all files in alphabetical order global $sortfile; $files = array(); if (file_exists($sortfile)) { $files = file($sortfile); array_walk($files, 'RemoveNewLines'); } else { $dir = opendir( $dirname ); while( $file = readdir( $dir ) ) { if (eregi("\.jpe?g$", $file) || eregi("\.gif$", $file) || eregi("\.png$", $file)) { $files[] = $file; } } sort($files); } return $files; } function GetNeighbours($imagelist, $currimage, &$previmage, &$nextimage) { // For a given image, return the next and previous ones $lastimage = count($imagelist) - 1; for ( $i=0; $i<=$lastimage; $i++) { if ($imagelist[$i] == $currimage) { if ($i == 0) { $nextimage = $imagelist[$i+1]; $previmage = NULL; return; } else if ($i == $lastimage) { $previmage = $imagelist[$i-1]; $nextimage = NULL; return; } else { $previmage = $imagelist[$i-1]; $nextimage = $imagelist[$i+1]; return; } } } $previmage = NULL; $nextimage = NULL; return; } function PrintError($message) { echo "

Error: $message

"; } function PrintHeader() { global $headerfile; global $pagecolor; global $textcolor; if (file_exists($headerfile)) { include($headerfile); } else { echo "\n"; } } function PrintFooter() { global $footerfile; global $title; if (file_exists($footerfile)) { include($footerfile); } else { echo "

"; echo "$title

\n"; } } function PrintRecentComments($recent) { global $thumb, $marginsize; if (! $recent) { return; } $imagelist = GetFileList(); $comments = array(); foreach ($imagelist as $filename) { $commentfile = "$thumb/$filename.txt"; if (file_exists($commentfile)) { $file = file($commentfile); foreach ($file as $line) { $line = chop($line)."###$filename"; $comments[] = $line; } } } rsort($comments); $count = 0; echo "

"; // Just in case; echo "

$recent most recently added comments:

"; foreach ($comments as $comment) { $comm = explode ("###", $comment); echo ""; echo "

"; echo ""; echo "From: ".$comm[1].", ".date("l, j F Y, g:i A T", $comm[0])."
"; echo "
    ".$comm[2]."
"; echo "
"; $image = $comm[3]; $maincomment = GetMainComment($image); $thumbimage = "$thumb/$image"; echo ""; if (file_exists($thumbimage)) { echo "\"$maincomment\""; } else { echo "$maincomment"; } echo ""; echo "
\n"; $count++; if ($count >= $recent) { break; } } echo "
\n"; } function PrintComments($filename) { // Given an image filename, finds, reads and formats the // associated file of guest comments global $thumb; $commentfile = "$thumb/$filename.txt"; if (file_exists($commentfile)) { $comments = file($commentfile); echo "

\n"; foreach ($comments as $comment) { $comm = explode ("###", $comment); echo ""; echo "From: ".$comm[1].", ".date("l, j F Y, g:i A T", $comm[0])."
"; echo "
    ".$comm[2]."
\n"; echo "
\n"; } echo "

\n"; } } function PrintCommentForm($filename) { global $scriptname; global $textcolor; global $pagecolor; ?>

METHOD=POST>
Name:
Message:

"1 seconds", 3 => "3 seconds", 5 => "5 seconds", 10 => "10 seconds", 20 => "20 seconds", 30 => "30 seconds", 40 => "40 seconds", 50 => "50 seconds", 60 => "1 minute"); echo "
"; echo "
"; } if ($intro) { // Print initial info in main frame if (file_exists($introfile)) { include($introfile); } else { PrintHeader(); echo "

$title

"; echo "

Select images from the left

"; } if ($guestcomment && $recentcount) { echo "
"; echo "

"; echo "See the $recentcount most recently added comments

"; } die; } if ($recent) { if ($guestcomment) { PrintRecentComments($recent); } echo "

Back to intro page

"; die; } if ($margin) { // Create a list of thumbnails if (!file_exists($thumb)) { if ( ! mkdir($thumb, 0755)) { PrintError("Could not create thumb dir - check write permissions"); die; } } PrintHeader(); $imagelist = GetFileList(); foreach ($imagelist as $image) { $thumbimage = $thumb."/".$image; $thumb_exists = file_exists($thumbimage); if (!$thumb_exists) { // Try to create the thumbnail $thumbwidth = 210; //$margin - 20; if ($imagemagick) { $thumb_exists = MakeThumbnailUsingIM($image, $thumbimage, $thumbwidth); } else { $thumb_exists = MakeThumbnailUsingGD($image, $thumbimage, $thumbwidth); } } $comment = GetMainComment($image); $image = CleanFilename($image); $thumbimage = CleanFilename($thumbimage); // The d=d.html was added to help dumb caches echo "
"; echo ""; if ($thumb_exists) { echo "

"; echo "\"$comment\"
"; echo $comment; echo "

"; } else { echo "
"; echo "$comment"; } echo "
\n"; } echo "

Back to the start

\n"; echo "


Site created using "; echo "Martin's Photo Frame

\n"; die; } if ($comment) { AddComment($comment, $name, $message); $image = $comment; } # This coded was added by Jose Galvez, 01-08-02 # the purpose if the code is to connect to a database and # obtain some info given the image name if ($image) { if (preg_match ("{^.[A-Za-z](\d\d-\d\d\d\d)}", $image, $matches)) { $regfind = $matches[1]; include("./dbcfg.cfg"); $link = mysql_connect($dbserver, $dbuser, $dbpass) or Die ("Opps I did it again"); mysql_select_db("tgmouse") or Die ("Not again"); $query = "select transgene1, transgene2, genotype1, genotype2, diagnosis from tgmousedata where pathnum like '%$regfind%'"; $result = mysql_query ($query) or Die ("you can't do anything right can you"); $line = mysql_fetch_row ($result); mysql_close(); } else { $regfind = 0; $line[0] = 'N/A'; $line[1] = 'N/A'; $line[2] = 'N/A'; $line[3] = 'N/A'; $line[4] = 'N/A'; } if (!file_exists($image)) { PrintError("Strangely, that picture doesn't exist"); die; } $imagelist = GetFileList(); GetNeighbours($imagelist, $image, $previmage, $nextimage); if ($slide && $nextimage) { echo ""; } else { $slide = "0"; } PrintHeader(); echo ""; if ($previmage) { echo ""; } if ($nextimage) { echo ""; echo ""; } echo "
"; PrintSlideshowForm($nextimage, $slide); echo "
\n"; if ($imagemagick) { $comment = Exec("$im_identify -format \"%c\" \"$image\""); } else { // Try and use rdjpgcom from libjpeg $comment = Exec(EscapeShellCmd("$getcomment $image")); } $image = CleanFilename($image); echo "

$image

"; if ($imagesize) { $imagewidth = "WIDTH=100%"; } echo "

";; if ($guestcomment) { echo "


Comments

"; PrintComments($image); PrintCommentForm($image); } PrintFooter(); die; } ?> <?PHP echo $shortTitle ?> This site works best wih frames, which your browser doesn't support. You can still browse this photo album, though, by starting <A HREF="<?PHP echo $scriptname?>?margin=<?PHP echo $marginsize?>">here</A>