Ejemplo n.º 1
0
 /**
  * Get the MIME type of the image
  *
  * @return string|null
  */
 public function getType()
 {
     if ($this->type) {
         return $this->type;
     }
     $this->stream->resetPointer();
     switch ($this->stream->getChars(2)) {
         case "BM":
             return $this->type = 'bmp';
         case "GI":
             return $this->type = 'gif';
         case chr(0xff) . chr(0xd8):
             return $this->type = 'jpeg';
         case chr(0x89) . 'P':
             return $this->type = 'png';
         default:
             return null;
     }
 }
Ejemplo n.º 2
0
 /**
  * Get the size of the image
  *
  * @return array
  */
 public function getSize()
 {
     $this->stream->resetPointer();
     return array_values($this->parseSize());
 }