Skip to content

armgit / Vvveb

Public Imported from GitHub
0

Powerful and easy to use cms to build websites, blogs or ecommerce stores.

Create destination folder if does not exist when saving a resized image

givanz35c2314d4b56
diff --git a/system/images.php b/system/images.php
index 8dd18cd..3e45290 100755
--- a/system/images.php
+++ b/system/images.php
@@ -35,7 +35,11 @@ use Vvveb\System\Media\Image;
class Images {
static public function resize($src, $dest, $width, $height, $method) {
- @mkdir(dirname($dest), (0755 & ~umask()), true);
+ $destDir = dirname($dest);
+
+ if (! file_exists($destDir)) {
+ @mkdir(dirname($dest), (0755 & ~umask()), true);
+ }
$img = new Image($src);
$result = $img->resize($width,$height, $method);