public function basic_view($alias, $display_item, $parent_item, $image_types, $encoded_seek_search_params, $search_position, $seek_search_params, $isthisCompoundObject, $previous_item, $next_item, $current_item_num, $totalitems) { $conf =& dmGetCollectionFieldInfo($alias); $itnum = $display_item['ptr']; $rc = dmGetItemInfo($alias, $itnum, $data); $parser = xml_parser_create(); xml_parse_into_struct($parser, $data, $structure, $index); xml_parser_free($parser); dmGetImageInfo($alias, $itnum, $filename, $type, $width, $height); $filename = substr($filename, strrpos($filename, "/") + 1); $file_extension = GetFileExt($filename); if (in_array($file_extension, $image_types)) { $is_image = true; $dimensions = Image::fit_width($width, $height, 640); $scaled_width = $dimensions[0]; $scaled_height = $dimensions[1]; $scaling_factor = $dimensions[2]; $file_url = "http://cdm9006.cdmhost.com/cgi-bin/getimage.exe?CISOROOT=" . $alias . "&CISOPTR=" . $itnum; $file_url .= "&DMWIDTH=" . $scaled_width . "&DMHEIGHT=" . $scaled_height . "&DMSCALE=" . $scaling_factor; } else { $is_image = false; $file_url = "http://cdm9006.cdmhost.com/cgi-bin/showfile.exe?CISOROOT=" . $alias . "&CISOPTR=" . $itnum; $encoded_file_url = urlencode("http://cdm9006.cdmhost.com/cgi-bin/showfile.exe?CISOROOT=" . $alias . "&CISOPTR=" . $itnum); } include 'basic_view.php'; }
private function load_settings() { if ($this->_settings == NULL) { dmGetCollectionImageSettings($this->alias, $pan_enabled, $minjpegdim, $zoomlevels, $maxderivedimg, $viewer, $docviewer, $compareviewer, $slideshowviewer); dmGetImageInfo($this->alias, $this->itnum, $this->file, $type, $width, $height); $this->_settings = array('pan_enabled' => $pan_enabled, 'minjpegdim' => $minjpegdim, 'zoomlevels' => $zoomlevels, 'maxderivedimg' => $maxderivedimg, 'viewer' => $viewer, 'docviewer' => $docviewer, 'compareviewer' => $compareviewer, 'slideshowviewer' => $slideshowviewer, 'width' => $width, 'height' => $height); } }
function &GetImageParameters($inputarray) { $base_url = "CISOROOT=" . $inputarray["CISOROOT"] . "&CISOPTR=" . $inputarray["CISOPTR"]; if (isset($inputarray['CISOSHOW'])) { $base_url .= "&CISOSHOW=" . $inputarray['CISOSHOW']; } global $dmrec, $querystr, $stat; $dmrec = isset($_GET["REC"]) ? $_GET["REC"] : 1; $dmrotate = isset($_GET["DMROTATE"]) ? $_GET["DMROTATE"] : "0"; $res = array(); $res["image_cisoroot"] = $inputarray["CISOROOT"]; $res["image_cisoptr"] = $inputarray["CISOPTR"]; $res["image_cisoshow"] = $inputarray["CISOSHOW"]; $rc = dmGetImageInfo($inputarray["CISOROOT"], $inputarray["CISOPTR"], $absfn, $ext, $imgwidth, $imgheight); if ($rc == -1) { print "<!-- No permission to access this item -->\n"; $res["image_src"] = -1; return $res; } $irc = 0; $types = explode(',', S_ALLOWED_ZOOM_IMAGE_TYPES); for ($i = 0; $i < count($types); $i++) { if ($ext == trim($types[$i])) { $irc = 1; break; } } if ($irc == 1) { /* Read the collection default parameters */ dmGetCollectionImageSettings($inputarray["CISOROOT"], $enabled, $minjpegdim, $step, $maxderivedimg, $viewer, $docviewer, $compareviewer, $slideshowviewer); $numsteps = count($step); $dmwidth = $inputarray["DMWIDTH"] != "" ? $inputarray["DMWIDTH"] : $viewer["width"]; $dmheight = $inputarray["DMHEIGHT"] != "" ? $inputarray["DMHEIGHT"] : $viewer["height"]; $dmscale = $inputarray["DMSCALE"] != "" ? $inputarray["DMSCALE"] : $viewer["scale"]; $width = $dmwidth; if ($width <= 0) { $width = DEFAULTWIDTH; } elseif ($width > MAXWIDTH) { $width = MAXWIDTH; } if ($dmheight == "A" && $dmscale == "W") { $height = $imgheight * $width / $imgwidth; } else { $height = $dmheight; if ($height <= 0) { $height = DEFAULTHEIGHT; } elseif ($height > MAXHEIGHT) { $height = MAXHEIGHT; } } if ($inputarray["DMX"] == "") { $oldx = 0; } else { $oldx = $inputarray["DMX"]; if ($oldx < 0) { $oldx = 0; } } if ($inputarray["DMY"] == "") { $oldy = 0; } else { $oldy = $inputarray["DMY"]; if ($oldy < 0) { $oldy = 0; } } if ($dmscale == "F") { for ($k = 0; $k < $numsteps; $k++) { if ($step[$k] * $imgwidth / 100 > $width || $step[$k] * $imgheight / 100 > $height) { break; } } $k--; if ($k < 0) { $k = 0; } $scale = $step[$k]; } elseif ($dmscale == "W") { $scale = $width * 100.0 / $imgwidth; } else { $scale = $dmscale; if ($scale <= 0) { $scale = 100; } } if ($scale > MAXSCALE) { $scale = MAXSCALE; } $nextscaleup = NextScale($scale, $step, $numsteps, 1); $nextscaledown = NextScale($scale, $step, $numsteps, 0); if ($inputarray["DMROTATE"] == 90) { $clickx = $width - $inputarray["y"]; $clicky = $inputarray["x"]; } elseif ($inputarray["DMROTATE"] == 180) { $clickx = $width - $inputarray["x"]; $clicky = $height - $inputarray["y"]; } elseif ($inputarray["DMROTATE"] == 270) { $clickx = $inputarray["y"]; $clicky = $width - $inputarray["x"]; } else { $clickx = $inputarray["x"]; $clicky = $inputarray["y"]; } $dmoldscale = $inputarray["DMOLDSCALE"]; $dmfull = $inputarray["DMFULL"]; $dmtext = $inputarray["DMTEXT"]; if ($dmtext != "") { $dmtext = str_replace(" ", "%20", $dmtext); $dmtext = str_replace("'", "%27", $dmtext); } if ($clickx != "") { if ($dmoldscale == "") { $oldscale = $nextscaledown; } else { $oldscale = $dmoldscale; } $offsetx = $clickx; if ($offsetx < 0) { $offsetx = 0; } $offsety = $clicky; if ($offsety < 0) { $offsety = 0; } if ($dmfull == "1") { $offsetx = $offsetx - $width / 2; $offsety = $offsety - $height / 2; } else { if (isset($dmoldscale[0]) && $dmoldscale[0] != "") { $offsetx = (int) ($scale / $oldscale * $offsetx) - $width / 2; $offsety = (int) ($scale / $oldscale * $offsety) - $height / 2; } else { $offsetx = (int) ($scale / $oldscale * ($offsetx - $width / 2)); $offsety = (int) ($scale / $oldscale * ($offsety - $height / 2)); } } $oldx = $oldx + $offsetx; if ($oldx + $width > $scale * $imgwidth / 100) { $oldx = (int) ($scale * $imgwidth / 100) - $width; } if ($oldx < 0) { $oldx = 0; } $oldy = $oldy + $offsety; if ($oldy + $height > $scale * $imgheight / 100) { $oldy = (int) ($scale * $imgheight / 100) - $height; } if ($oldy < 0) { $oldy = 0; } } /* Zoom in */ if ($nextscaleup > $scale) { if ($scale * $imgwidth / 100 < $width) { $min = (int) ($scale * $imgwidth) / 100; } else { $min = $width; } $tempx = (int) ($nextscaleup / $scale * ($oldx + $min / 2)) - $width / 2; if ($tempx + $width > $nextscaleup * $imgwidth / 100) { $tempx = (int) ($nextscaleup * $imgwidth / 100) - $width; } if ($tempx < 0) { $tempx = 0; } if ($scale * $imgheight / 100 < $height) { $min = (int) ($scale * $imgheight) / 100; } else { $min = $height; } $tempy = (int) ($nextscaleup / $scale * ($oldy + $min / 2)) - $height / 2; if ($tempy + $height > $nextscaleup * $imgheight / 100) { $tempy = (int) ($nextscaleup * $imgheight / 100) - $width; } if ($tempy < 0) { $tempy = 0; } $res["image_zoomin_link"] = zoom_link($inputarray["CISOROOT"], $inputarray["CISOPTR"], $nextscaleup, $width, $height, $tempx, $tempy, $dmtext, $dmrec, $dmrotate); } else { $res["image_zoomin_link"] = ""; } /* Zoom out */ if ($scale * $imgwidth / 100 < $width) { $min = (int) ($scale * $imgwidth) / 100; } else { $min = $width; } $tempx = (int) ($nextscaledown / $scale * ($oldx + $min / 2)) - $width / 2; if ($tempx + $width > $nextscaledown * $imgwidth / 100) { $tempx = (int) ($nextscaledown * $imgwidth / 100) - $width; } if ($tempx < 0) { $tempx = 0; } if ($scale * $imgheight / 100 < $height) { $min = (int) ($scale * $imgheight) / 100; } else { $min = $height; } $tempy = (int) ($nextscaledown / $scale * ($oldy + $min / 2)) - $height / 2; if ($tempy + $height > $nextscaledown * $imgheight / 100) { $tempy = (int) ($nextscaledown * $imgheight / 100) - $height; } if ($tempy < 0) { $tempy = 0; } if ($nextscaledown < $scale) { $res["image_zoomout_link"] = zoom_link($inputarray["CISOROOT"], $inputarray["CISOPTR"], $nextscaledown, $width, $height, $tempx, $tempy, $dmtext, $dmrec, $dmrotate); } else { $res["image_zoomout_link"] = ""; } /* Scale percentage box */ $temppct = sprintf("%.1f", $scale); $res["image_pct_display"] = $temppct; /* Zoom steps */ $steps = array(); foreach ($step as $current_step) { $steps[$current_step] = array('level' => $current_step, 'url' => zoom_link($inputarray["CISOROOT"], $inputarray["CISOPTR"], $current_step, $width, $height, $tempx, $tempy, $dmtext, $dmrec, $dmrotate)); } ksort($steps, SORT_NUMERIC); $res['steps'] = $steps; $res["current_zoom"] = $scale; /* Full res */ if ($scale * $imgwidth / 100 < $width) { $min = (int) ($scale * $imgwidth) / 100; } else { $min = $width; } $tempx = (int) (100.0 / $scale * ($oldx + $min / 2)) - $width / 2; if ($tempx + $width > 100 * $imgwidth / 100) { $tempx = (int) (100 * $imgwidth / 100) - $width; } if ($tempx < 0) { $tempx = 0; } if ($scale * $imgheight / 100 < $height) { $min = (int) ($scale * $imgheight) / 100; } else { $min = $height; } $tempy = (int) (100.0 / $scale * ($oldy + $min / 2)) - $height / 2; if ($tempy + $height > 100.0 * $imgheight / 100) { $tempy = (int) (100 * $imgheight / 100) - $width; } if ($tempy < 0) { $tempy = 0; } $res["image_full_link"] = $base_url . "&DMSCALE=100&DMWIDTH=" . $width . "&DMHEIGHT=" . $height . "&DMX=" . $tempx . "&DMY=" . $tempy . "&DMTEXT=" . str_replace('%2520', '%20', urlencode($dmtext)) . "&REC=" . $dmrec . "&DMROTATE=" . $dmrotate; /* Fit in window */ for ($k = 0; $k < $numsteps; $k++) { if ($step[$k] * $imgwidth / 100 > $width || $step[$k] * $imgheight / 100 > $height) { break; } } $k--; if ($k < 0) { $k = 0; } $res["image_fit_link"] = $base_url . "&DMSCALE=" . $step[$k] . "&DMWIDTH=" . $width . "&DMHEIGHT=" . $height . "&DMTEXT=" . str_replace('%2520', '%20', urlencode($dmtext)) . "&REC=" . $dmrec . "&DMROTATE=" . $dmrotate; /* Full width */ $tempscale = $width * 100.0 / $imgwidth; $temppct = sprintf("%.5f", $tempscale); $res["image_width_link"] = $base_url . "&DMSCALE=" . $temppct . "&DMWIDTH=" . $width . "&DMHEIGHT=" . $height . "&DMTEXT=" . str_replace('%2520', '%20', urlencode($dmtext)) . "&REC=" . $dmrec . "&DMROTATE=" . $dmrotate; $res["image_scale"] = $nextscaleup; $res["image_width"] = $width; $res["image_height"] = $height; if ($scale == $nextscaleup) { $res["image_full"] = "1"; } else { $res["image_full"] = "0"; } if ($scale * $imgwidth / 100 < $width) { $min = (int) ($scale * $imgwidth) / 100; } else { $min = $width; } $tempx = (int) ($nextscaleup / $scale * ($oldx + $min / 2)) - $width / 2; if ($tempx + $width > $nextscaleup * $imgwidth / 100) { $tempx = (int) ($nextscaleup * $imgwidth / 100) - $width; } if ($tempx < 0) { $tempx = 0; } if ($scale * $imgheight / 100 < $height) { $min = (int) ($scale * $imgheight) / 100; } else { $min = $height; } $tempy = (int) ($nextscaleup / $scale * ($oldy + $min / 2)) - $height / 2; if ($tempy < 0) { $tempy = 0; } $res["image_x"] = $tempx; $res["image_y"] = $tempy; $res["image_text"] = $dmtext; $temppct = sprintf("%.5f", $scale); $res["image_src"] = "/cgi-bin/getimage.exe?" . $base_url . "&DMSCALE=" . $temppct . "&DMWIDTH=" . $width . "&DMHEIGHT=" . $height . "&DMX=" . $oldx . "&DMY=" . $oldy . "&DMTEXT=" . str_replace('%2520', '%20', urlencode($dmtext)) . "&REC=" . $dmrec . "&DMROTATE=" . $dmrotate; if ($imgwidth < $imgheight) { $scalet = MAXTHUMBDIM * 100.0 / $imgheight; } else { $scalet = MAXTHUMBDIM * 100.0 / $imgwidth; } $thumbw = (int) ($scalet * $imgwidth / 100.0); $thumbh = (int) ($scalet * $imgheight / 100.0); $tx = (int) ($scalet / $scale * $oldx); $ty = (int) ($scalet / $scale * $oldy); $tw = (int) ($scalet / $scale * $width); $th = (int) ($scalet / $scale * $height); if ($tw > $thumbw) { $tw = $thumbw; } if ($th > $thumbh) { $th = $thumbh; } $temppct = sprintf("%.5f", $scalet); $res["image_oldscale"] = $temppct; $temppct = sprintf("%.5f", $scale); $res["image_currentscale"] = $temppct; $temppct = sprintf("%.5f", $scalet); $res["image_guide_src"] = "/cgi-bin/getimage.exe?" . $base_url . "&DMSCALE=" . $temppct . "&DMWIDTH=" . $thumbw . "&DMHEIGHT=" . $thumbh . "&DMX=0&DMY=0" . "&DMBOUND=" . $tx . "," . $ty . "," . $tw . "," . $th . "&REC=" . $dmrec . "&DMROTATE=" . $dmrotate; $res["image_thumbnail_width"] = $thumbw; /* Rotate functions */ if ($dmrotate == "360") { $dmrotate = "0"; } $rleft = $dmrotate + 90; $rright = ($dmrotate + 270) % 360; $res["image_rotateleft_link"] = stripUrlVar($querystr, 'DMROTATE') . "&DMROTATE=" . $rleft; $res["image_rotateright_link"] = stripUrlVar($querystr, 'DMROTATE') . "&DMROTATE=" . $rright; } else { $res["image_src"] = -1; } return $res; }
function get_item_settings($alias, $itnum, $filetype) { global $isImage; // arrrgh! I know! $isthisImage = in_array($filetype, $isImage); if ($isthisImage) { dmGetCollectionImageSettings($alias, $pan_enabled, $minjpegdim, $zoomlevels, $maxderivedimg, $viewer, $docviewer, $compareviewer, $slideshowviewer); dmGetImageInfo($alias, $itnum, $filename, $type, $width, $height); return array('pan_enabled' => $pan_enabled, 'width' => $width, 'height' => $height, 'thumbnail' => "/cgi-bin/thumbnail.exe?CISOROOT=" . $alias . "&CISOPTR=" . $itnum, 'full_image' => "/cgi-bin/getimage.exe?CISOROOT=" . $alias . "&CISOPTR=" . $itnum . "&DMWIDTH=" . $width . "&DMHEIGHT=" . $height . "&DMSCALE=100"); } else { return NULL; } }
} $filetype = GetFileExt($display_item['structure'][$display_item['index']["FIND"][0]]["value"]); $doctitle = $display_item['structure'][$display_item['index']["TITLE"][0]]["value"]; $isthisImage = in_array($filetype, $isImage); if ($isthisImage) { dmGetCollectionImageSettings($alias, $pan_enabled, $minjpegdim, $zoomlevels, $maxderivedimg, $viewer, $docviewer, $compareviewer, $slideshowviewer); include "discover/pan_scr.php"; define("FACEBOX", 'display'); define("LIGHTBOX", 'display'); define("SLIDER", 'display'); $lightbox_images = array('fullscreen_popup' => array('alias' => $alias, 'itnum' => $itnum)); // full-screen view settings if ($lightbox_images) { foreach ($lightbox_images as $id => $data) { $filename = $type = $width = $height = ''; $image_info = dmGetImageInfo($alias, $itnum, $filename, $type, $width, $height); $lightbox_images[$id]['filename'] = $filename; $lightbox_images[$id]['type'] = $type; $lightbox_images[$id]['width'] = $width; $lightbox_images[$id]['height'] = $height; } } $printable = true; } $title = 'Viewer — Seeking Michigan — ' . $doctitle; $collection_url = SEEKING_MICHIGAN_HOST . '/discover/' . $collection_name; define("BODY_CLASS", "discover"); include 'header.php'; ?> <div id="main-content"> <div class="wrapper mod">