Browse Source

"Насильное создание варианта"

MIRSPORTA-591 Неправильный ресайзинг фото из фотогалереи
master
Alexander Demidov 10 years ago
parent
commit
9663b19697
  1. 6
      File.php

6
File.php

@ -80,14 +80,14 @@ abstract class File
* @param $force_create bool * @param $force_create bool
* @return ImageVariant * @return ImageVariant
*/ */
public function getImageVariant($size, $force_create = false)
public function getImageVariant($size, $force_create = false, $important_create = false)
{ {
/** /**
* @var $this Image * @var $this Image
*/ */
if (!array_key_exists($size, $this->variants)) {
if (!array_key_exists($size, $this->variants) || $important_create) {
$original_file_path = \Majestic\Config::get('PATH_WEB_ROOT') . '/' . $this->getWebName(); $original_file_path = \Majestic\Config::get('PATH_WEB_ROOT') . '/' . $this->getWebName();
if ($force_create && $this->getIsNoEmpty() && file_exists($original_file_path)) {
if (($important_create && $this->getIsNoEmpty() && file_exists($original_file_path)) || ($force_create && $this->getIsNoEmpty() && file_exists($original_file_path))) {
Upload::imageVariant($this, $size); Upload::imageVariant($this, $size);
} else { } else {
$this->variants[$size] = new ImageVariant(); $this->variants[$size] = new ImageVariant();

Loading…
Cancel
Save