示例#1
0
 public function testImageFileSystemPath()
 {
     $image = new Image(__DIR__ . '/img/test.jpg');
     $this->assertNotEmpty($image->getBlob());
 }
示例#2
0
 /**
  * @param $identifier
  * @return Image|null
  */
 public function getImage($identifier)
 {
     $image = $this->getMongoCollection()->findOne([$this->getIdentifierName() => $identifier]);
     if ($image) {
         $imgContainer = new Image();
         $imgContainer->setBlob($image['blob']->bin);
         $imgContainer->setSize(strlen($image['blob']->bin));
         $imgContainer->setMimeType($this->detectBufferMimeType($image['blob']->bin));
         return $imgContainer;
     } else {
         return null;
     }
 }