Skip to content

Commit

Permalink
fix bug with placeHolder
Browse files Browse the repository at this point in the history
  • Loading branch information
CostaRico committed Aug 11, 2014
1 parent b31d513 commit 32bb584
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion behaviors/ImageBehave.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down

0 comments on commit 32bb584

Please sign in to comment.