diff --git a/CMS.php b/CMS.php index 134cb26..2e23841 100644 --- a/CMS.php +++ b/CMS.php @@ -8,6 +8,7 @@ use yii\helpers\Inflector; use yii\helpers\Url; use yii\helpers\VarDumper; +use yii\helpers\FileHelper; /** * Дополнительные функции системы. @@ -215,14 +216,16 @@ public static function processImage($size = false, $filename = 'file.jpg', $uplo $options['watermark'] = false; $error = true; } - $hash = ''; + $hash = time(); - $exif = exif_read_data($fullPath, 0, true); - if (isset($exif['FILE']['FileDateTime'])) { - $hash = $exif['FILE']['FileDateTime']; - } if (!file_exists($thumbPath) && file_exists($fullPath)) { $fileInfo = pathinfo($fullPath); + if(!in_array($fileInfo['extension'], ['png','svg'])){ + $exif = exif_read_data(FileHelper::normalizePath($fullPath), 0, true); + if (isset($exif['FILE']['FileDateTime'])) { + $hash = $exif['FILE']['FileDateTime']; + } + } if (!in_array($fileInfo['extension'], ['svg'])) { $img = Yii::$app->img; $img->load($fullPath);