/** * @param ModelContract $model * @param Image $image * @param string $styleName * @param \Closure $closure * * @return Image */ protected function processStyle(ModelContract $model, $image, $styleName, $closure) { if (is_null($closure)) { $this->save($image, $model->getPath($styleName)); return $image; } $processed = $this->applyStyle($image, $closure); $this->save($processed, $model->getPath($styleName)); return $processed; }
/** * @param ModelContract $model * @param string $style * * @return string */ protected function doParsePath(ModelContract $model, $style) { $string = preg_replace("/:style\\b/", $style, $this->path); foreach ($this->getInterpolations() as $key => $value) { if (strpos($string, $key) !== false) { $string = preg_replace("/{$key}\\b/", $model->getAttribute($value), $string); } } return $string; }