Ejemplo n.º 1
0
 /**
  * @param $identifier
  * @param BlobInterface $blob
  * @return bool
  */
 public function updateImage($identifier, BlobInterface $blob)
 {
     $field = [$this->getIdentifierName() => $identifier];
     $modify = ['$set' => ['blob' => new \MongoBinData($blob->getBlob(), \MongoBinData::CUSTOM)]];
     $option = ['multiple' => true];
     $result = $this->getMongoCollection()->update($field, $modify, $option);
     return $this->handleResult($result);
 }
Ejemplo n.º 2
0
 /**
  * @param $identifier
  * @param BlobInterface $blob
  * @return bool
  */
 public function saveImage($identifier, BlobInterface $blob)
 {
     try {
         $image = $this->_buildPathImage($identifier);
         return (bool) file_put_contents($image, $blob->getBlob());
     } catch (\Exception $e) {
         return false;
     }
 }
Ejemplo n.º 3
0
 /**
  * @param BlobInterface $blob
  * @return ImagickAdapter
  * @throws ImageException
  */
 public function setBlob(BlobInterface $blob)
 {
     try {
         $result = $this->getAdapter()->readimageblob($blob->getBlob());
     } catch (\Exception $e) {
         throw new ImageException('Error loading image', null, $e);
     }
     if ($result === false) {
         throw new ImageException('Error loading image');
     }
     return $this;
 }
Ejemplo n.º 4
0
 public function updateImage($identifier, BlobInterface $blob)
 {
     $identifier = $this->getNameStrategy()->hydrate($identifier);
     return $this->s3Client->saveFile($identifier, $blob->getBlob());
 }