_resource->dictionary; $imageDictionary->Width = new Zend_Pdf_Element_Numeric($imageInfo[0]); $imageDictionary->Height = new Zend_Pdf_Element_Numeric($imageInfo[1]); $imageDictionary->ColorSpace = new Zend_Pdf_Element_Name($colorSpace); $imageDictionary->BitsPerComponent = new Zend_Pdf_Element_Numeric($imageInfo['bits']); if ($imageInfo[2] == IMAGETYPE_JPEG) { $imageDictionary->Filter = new Zend_Pdf_Element_Name('DCTDecode'); } else if ($imageInfo[2] == IMAGETYPE_JPEG2000){ $imageDictionary->Filter = new Zend_Pdf_Element_Name('JPXDecode'); } if (($imageFile = @fopen($imageFileName, 'rb')) === false ) { #require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception( "Can not open '$imageFileName' file for reading." ); } $byteCount = filesize($imageFileName); $this->_resource->value = ''; while ($byteCount > 0 && !feof($imageFile)) { $nextBlock = fread($imageFile, $byteCount); if ($nextBlock === false) { #require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception( "Error occured while '$imageFileName' file reading." ); } $this->_resource->value .= $nextBlock; $byteCount -= strlen($nextBlock); } if ($byteCount != 0) { #require_once 'Zend/Pdf/Exception.php'; throw new Zend_Pdf_Exception( "Error occured while '$imageFileName' file reading." ); } fclose($imageFile); $this->_resource->skipFilters(); $this->_width = $imageInfo[0]; $this->_height = $imageInfo[1]; $this->_imageProperties = array(); $this->_imageProperties['bitDepth'] = $imageInfo['bits']; $this->_imageProperties['jpegImageType'] = $imageInfo[2]; $this->_imageProperties['jpegColorType'] = $imageInfo['channels']; } /** * Image width */ public function getPixelWidth() { return $this->_width; } /** * Image height */ public function getPixelHeight() { return $this->_height; } /** * Image properties */ public function getProperties() { return $this->_imageProperties; } }