/** * Enrich node metadata * @param AJXP_Node $ajxpNode */ public function extractImageMetadata(&$ajxpNode) { $currentPath = $ajxpNode->getUrl(); $wrapperClassName = $ajxpNode->wrapperClassName; $isImage = AJXP_Utils::is_image($currentPath); $ajxpNode->is_image = $isImage; if (!$isImage) { return; } $setRemote = false; $remoteWrappers = $this->getFilteredOption("META_EXTRACTION_REMOTEWRAPPERS"); if (is_string($remoteWrappers)) { $remoteWrappers = explode(",", $remoteWrappers); } $remoteThreshold = $this->getFilteredOption("META_EXTRACTION_THRESHOLD"); if (in_array($wrapperClassName, $remoteWrappers)) { if ($remoteThreshold != 0 && isset($ajxpNode->bytesize)) { $setRemote = $ajxpNode->bytesize > $remoteThreshold; } else { $setRemote = true; } } if ($isImage) { if ($setRemote) { $ajxpNode->image_type = "N/A"; $ajxpNode->image_width = "N/A"; $ajxpNode->image_height = "N/A"; $ajxpNode->readable_dimension = ""; } else { $realFile = $ajxpNode->getRealFile(); list($width, $height, $type, $attr) = @getimagesize($realFile); if ($this->getFilteredOption("EXIF_ROTATION")) { require_once AJXP_INSTALL_PATH . "/plugins/editor.diaporama/PThumb.lib.php"; $pThumb = new PThumb($this->getFilteredOption["THUMBNAIL_QUALITY"], $this->getFilteredOption("EXIF_ROTATION")); $orientation = $pThumb->exiforientation($realFile, false); if ($pThumb->rotationsupported($orientation)) { $ajxpNode->image_exif_orientation = $orientation; if ($orientation > 4) { $tmp = $height; $height = $width; $width = $tmp; } } } $ajxpNode->image_type = image_type_to_mime_type($type); $ajxpNode->image_width = $width; $ajxpNode->image_height = $height; $ajxpNode->readable_dimension = $width . "px X " . $height . "px"; } } //$this->logDebug("CURRENT NODE IN EXTRACT IMAGE METADATA ", $ajxpNode); }