Browse Source

Добавлен параметр $force_create в метод File.getImageVariant(). Значение по-умолчанию - false.

master
Alexander Demidov 11 years ago
parent
commit
df1207bd3e
  1. 5
      File.class.php

5
File.class.php

@ -64,15 +64,16 @@ abstract class File
/** /**
* @param $size string * @param $size string
* @param $force_create bool
* @return ImageVariant * @return ImageVariant
*/ */
public function getImageVariant($size)
public function getImageVariant($size, $force_create = false)
{ {
/** /**
* @var $this Image * @var $this Image
*/ */
if (!array_key_exists($size, $this->variants)) { if (!array_key_exists($size, $this->variants)) {
if ($this->getIsNoEmpty()) {
if ($force_create && $this->getIsNoEmpty()) {
Upload::imageVariant($this, $size); Upload::imageVariant($this, $size);
} else { } else {
$this->variants[$size] = new ImageVariant(); $this->variants[$size] = new ImageVariant();

Loading…
Cancel
Save