function &GetThumbnailDim($alias, $ptr) { $rc = dmGetCollectionParameters($alias, $name, $path); if ($rc < 0) { return -1; /* no collection permission */ } $rc = ReadItemDesc($path, $ptr, $data); if ($rc == -1) { return -1; } $findval = str_replace("&", "&", GetXMLField("find", $data)); $f = explode(".", $findval); $thumbfile = $path . "/image/" . "icon" . $f[0] . ".jpg"; if (file_exists($thumbfile)) { $dim = GetImageDimensions($thumbfile); } else { $dim = array(); $dim["width"] = 0; $dim["height"] = 0; } return $dim; }
function dmGetImageInfo($alias, $ptr, &$filename, &$type, &$width, &$height) { $rc = dmGetCollectionParameters($alias, $name, $path); if ($rc < 0) { return -1; /* no collection permission */ } $rc = ReadItemDesc($path, $ptr, $data); if ($rc == -1) { return -1; } /* FIX to decode ampersands in filenames */ $findval = str_replace("&", "&", GetXMLField("find", $data)); $filename = trim($path . "/image/" . $findval); $ext = GetFileExt($filename); if ($ext == "jpg" || $ext == "gif" || $ext == "png" || $ext == "jp2" || $ext == "tif" || $ext == "tiff") { $type = $ext; $size = GetImageDimensions($filename); $width = $size["width"]; $height = $size["height"]; } elseif ($ext == "url") { $type = ""; $width = 0; $height = 0; if (file_exists($filename)) { $urlFile = fopen($filename, "r"); $n = filesize($filename); $urlbuffer = fread($urlFile, $n); fclose($urlFile); if (strstr($urlbuffer, "about:blank")) { $type = "null"; } } } else { $type = ""; $width = 0; $height = 0; } }