public function imageURL($alias, $attribute = false)
{
if ($attribute && !in_array($attribute, $this->attributes)) {
return false;
} elseif ($attribute === false && !($attribute = reset($this->attributes))) {
return false;
}
$owner = Owners::findOne(['owner_id' => $this->owner->primaryKey, 'owner' => $this->name, 'owner_attribute' => $attribute]);
if ($owner instanceof Owners) {
if ($mediaFile = Mediafile::findOne($owner->mediafile_id)) {
return $mediaFile->getThumbUrl($alias);
}
}
return false;
}