//file: functions.inc //this is some defined functions for the photo album //DO NOT EDIT THIS FILE require('siteinfo.php3'); function CreateImage($size,$source,$dest,$border=0) { $sourcedate = 0; $destdate = 0; global $convert; if (file_exists($dest)) { clearstatcache(); $sourceinfo = stat($source); $destinfo = stat($dest); $sourcedate = $sourceinfo[10]; $destdate = $destinfo[10]; } if (!file_exists("$dest") or ($sourcedate > $destdate)) { global $ImageTool; $imgsize = GetImageSize($source); $width = $imgsize[0]; $height = $imgsize[1]; if ($height<$width) { $new_width = $size; $new_height = ceil($size * $height / $width); }else { $new_width = ceil($size * $width / $height); $new_height = $size; } if ($ImageTool == "gd") { $im = ImageCreateFromJPEG($source); $new_im = ImageCreate($new_width,$new_height); ImageCopyResized($new_im,$im,0,0,0,0,$new_width,$new_height,ImageSX($im),ImageSY($im)); ImageJPEG($new_im,$dest,75); } elseif ($ImageTool == "im") { // Older ImageMagick //system("$convert -quality 80 -antialias -sample $new_width" . "x" . "$new_height -bordercolor black -border $border \"$source\" \"$dest\" 2>&1"); // Newer ImageMagick system("$convert -quality 80 -antialias -sample $new_width" . "x" . "$new_height -bordercolor black -border $border" . "x" . "$border \"$source\" \"$dest\" 2>&1"); } } } function NavBar($mode,$path,$start) { $endpoint = basename($path); global $pix_base; global $realbase; global $dispsize; global $sitehome; global $display_cols; if ($sitehome != '') { print "Home -> \n"; } print "Albums\n"; $doo = split("/",$path); $prepath = ''; while (list($foo,$filename) = each($doo)) { if ($prepath) { $fullname = $prepath . "/" . $filename; } else { $fullname = $filename; } if ($filename == $endpoint) { print " -> $filename\n"; } else { print " -> $filename\n"; } $prepath = $fullname; } $fn = $pix_base . "/" . $path; $infofile = ""; if (is_dir($fn)) { $infofile = $pix_base . "/" . $path . "/info.txt"; } else { $infofile = $pix_base . "/" . preg_replace('/(.*)\.jpg/i', '\1.txt', $path); } if (file_exists($infofile)) { list($pictureTitle,$desc) = ParseInfoFile($infofile, $name); print " \n
" . $pictureTitle . "
"; } } function PrintAlbumName($pix_base, $name) { $infofile = $pix_base . "/" . $name . "/info.txt"; $photoAlbumTitle = ""; if (file_exists($infofile)) { list($photoAlbumTitle,$desc) = ParseInfoFile($infofile, $name); } else { $photoAlbumTitle = $name; } print ""; print "$photoAlbumTitle\n"; print "