/** * @param AttachableModel $model * @param string $template * @return string */ public function parseImagePath(AttachableModel $model, $template = 'original') { $id = $model->id; $filename = $model->file_name; $extension = $model->file_extension; $fileroot = $model->file_root; $path = $model->getUnparsedImagesPath(); foreach ($this->imageInterpolations as $interpolation) { $path = str_ireplace($this->startSymbol . $interpolation . $this->endSymbol, ${$interpolation}, $path); } return $path; }
/** * @param AttachableModel $model * @param Image $image * @param $templateName */ protected function saveSingleTemplate(AttachableModel $model, Image $image, $templateName) { $this->storage->put($model->getPath($templateName), $image->encode($model->file_extension)); }
/** * @param AttachableModel $model * @return ProcessorContract */ protected function getProcessor(AttachableModel $model) { return $model->useInterventionImage() ? $this->imageProcessor : $this->fileProcessor; }
/** * @param AttachableModel $model */ protected function setDisk(AttachableModel $model) { $this->storage->setDisk($model->getDisk()); }