Commit 7e78b764 authored by Nicolas Widart's avatar Nicolas Widart

Adding force create option

parent c5b0ebec
...@@ -31,13 +31,17 @@ class Imagy ...@@ -31,13 +31,17 @@ class Imagy
$this->imageFactory = $imageFactory; $this->imageFactory = $imageFactory;
} }
public function get($path, $thumbnail) public function get($path, $thumbnail, $forceCreate = false)
{ {
$filename = '/assets/media/' . $this->newFilename($path, $thumbnail); $filename = '/assets/media/' . $this->newFilename($path, $thumbnail);
try { try {
$this->finder->get(public_path(). $filename); $this->finder->get(public_path(). $filename);
if (!$forceCreate) {
return $filename; return $filename;
}
} catch (FileNotFoundException $e) { } catch (FileNotFoundException $e) {
// Continue execution
}
$image = $this->image->make(public_path() . $path); $image = $this->image->make(public_path() . $path);
foreach ($this->config->get("media::thumbnails.{$thumbnail}") as $manipulation => $options) { foreach ($this->config->get("media::thumbnails.{$thumbnail}") as $manipulation => $options) {
...@@ -50,7 +54,6 @@ class Imagy ...@@ -50,7 +54,6 @@ class Imagy
return $filename; return $filename;
} }
}
/** /**
* Prepend the thumbnail name to filename * Prepend the thumbnail name to filename
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment