Метод getThumb для упрощенного доступа к сорцам фоток в шаблонизаторе

This commit is contained in:
2016-05-27 15:26:42 +03:00
parent f5d69584ea
commit ee07891856

View File

@ -91,4 +91,11 @@ abstract class Image extends File
return parent::getImageVariant($size, $force_create, $important_create); return parent::getImageVariant($size, $force_create, $important_create);
} }
public function getThumb($width = 0, $height = 0, $crop_method = null) {
if ( $width == 0 && $height == 0 ) {
return \Majestic\Config::get('static_url') . $this->getWebName();
}
return \Majestic\Config::get('static_url') . $this->getVariant($width . 'x' . $height)->getWebName();
}
} }