Example #1
0
 /**
  * Get the original image raw data
  *
  * @param string $image Image file name, URL or a '@' character followed by the image data string.
  *                      To link an image without embedding it on the document, set an asterisk character
  *                      before the URL (i.e.: '*http://www.example.com/image.jpg').
  *
  * @return array Image data array
  */
 protected function getRawData($image)
 {
     // default data to return
     $data = array('key' => '', 'defprint' => false, 'raw' => '', 'file' => '', 'exturl' => false, 'width' => 0, 'height' => 0, 'type' => 0, 'native' => false, 'mapto' => IMAGETYPE_PNG, 'bits' => 8, 'channels' => 3, 'colspace' => 'DeviceRGB', 'icc' => '', 'filter' => 'FlateDecode', 'parms' => '', 'pal' => '', 'trns' => array(), 'data' => '', 'ismask' => false);
     if (empty($image)) {
         throw new ImageException('Empty image');
     }
     if ($image[0] === '@') {
         // image from string
         $data['raw'] = substr($image, 1);
     } else {
         if ($image[0] === '*') {
             // not-embedded external URL
             $data['exturl'] = true;
             $image = substr($image, 1);
         }
         $data['file'] = $image;
         $fobj = new File();
         $data['raw'] = $fobj->getFileData($image);
     }
     return $this->getMetaData($data);
 }