/** * @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); }
/** * @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; } }
/** * @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; }
public function updateImage($identifier, BlobInterface $blob) { $identifier = $this->getNameStrategy()->hydrate($identifier); return $this->s3Client->saveFile($identifier, $blob->getBlob()); }