From 32bb584c1ef6a7294cd214506cf389f2f99dcdfb Mon Sep 17 00:00:00 2001 From: Costa Date: Mon, 11 Aug 2014 12:42:36 +0400 Subject: [PATCH] fix bug with placeHolder --- behaviors/ImageBehave.php | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/behaviors/ImageBehave.php b/behaviors/ImageBehave.php index dcd5412..ee62b1c 100755 --- a/behaviors/ImageBehave.php +++ b/behaviors/ImageBehave.php @@ -91,9 +91,16 @@ public function attachImage($absolutePath, $isMain = false) unlink($newAbsolutePath); throw new \Exception(array_shift($ar)); } + $img = $this->owner->getImage(); //If main image not exists - if(!$this->owner->getImage() or $isMain){ + if( + is_object($img) && get_class($img)=='rico\yii2images\models\PlaceHolder' + or + $img == null + or + $isMain + ){ $this->setMainImage($image); }