diff --git a/File.class.php b/File.class.php index d284ff4..44a4104 100644 --- a/File.class.php +++ b/File.class.php @@ -116,14 +116,14 @@ abstract class File * @var $image Image */ if ($this->getIsNoEmpty()) { - unlink($this->getRealPath()); + @unlink($this->getRealPath()); } if (get_parent_class($this) == 'Image') { $image = $this; - foreach ($image->variants as $size) { + foreach ($image->getSizes() as $size) { $image_variant = $image->getVariant($size); if ($image_variant->getIsNoEmpty()) { - unlink($image->getRealPath()); + @unlink($image->getRealPath()); } } } diff --git a/Upload.class.php b/Upload.class.php index 4e4ccfe..2c14dd2 100644 --- a/Upload.class.php +++ b/Upload.class.php @@ -113,15 +113,20 @@ abstract class Upload } else { $greagwar_image = self::getGreagwarImage($tmp_file_path); } - if ($width || $height) { - if (!(ImageVariant::getIsClass($image)) && Image::getIsSubClass($image)) { - $greagwar_image->resize($width, $height, 0xffffff, $force = false, $rescale = false, $crop = true); - } else { - $greagwar_image->resize($width, $height, 0xffffff, $force = false, $rescale = false, $crop = false); - } - } - $image->type = $greagwar_image->guessType(); - $file_path = $greagwar_image->cacheFile($image->type, $quality = 100, true); + $image->type = $greagwar_image->guessType(); + if (!Config::get('PYTHON_PIL_RESIZE')) { + if ($width || $height) { + if (!(ImageVariant::getIsClass($image)) && Image::getIsSubClass($image)) { + $greagwar_image->resize($width, $height, 0xffffff, $force = false, $rescale = false, $crop = true); + } else { + $greagwar_image->resize($width, $height, 0xffffff, $force = false, $rescale = false, $crop = false); + } + } + $file_path = $greagwar_image->cacheFile($image->type, $quality = 100, true); + } else { + $hash = $greagwar_image->getHash($image->type, $quality = 100); + $file_path = $greagwar_image->generateFileFromhash($hash); + } $image->size = filesize($file_path); $path_parts = pathinfo($file_path); $image->path = preg_replace('#^' . Config::get('PATH_WEB_ROOT') . '/#', '', $path_parts['dirname']);