Skip to content
Code-Schnipsel Gruppen Projekte
Commit 9a786ec7 erstellt von Michael Danielczok's avatar Michael Danielczok
Dateien durchsuchen

Merge branch 'dev'

Übergeordnete 3f3d3488 f73119fb
No related branches found
No related tags found
Keine zugehörigen Merge Requests gefunden
......@@ -243,22 +243,35 @@ function smarty_function_image($params, $smarty)
$maxWidth = '';
$maxHeight = '';
$ratio = false;
try {
$maxWidth = $Image->getWidth();
$maxHeight = $Image->getHeight();
if ($maxWidth && $maxHeight) {
$ratio = round($maxWidth / $maxHeight);
}
} catch (Exception $Exception) {
QUI\System\Log::addDebug($Exception->getMessage());
}
if (empty($params['width']) || $params['width'] > $maxWidth) {
if (isset($params['width']) && $params['width'] > $maxWidth) {
$params['width'] = $maxWidth;
}
if (empty($params['height']) || $params['height'] > $maxHeight) {
if (isset($params['height']) && $params['height'] > $maxHeight) {
$params['height'] = $maxHeight;
}
if ($ratio && empty($params['width']) && !empty($params['height'])) {
$params['width'] = $params['height'] * $ratio;
}
if ($ratio && empty($params['height']) && !empty($params['width'])) {
$params['height'] = $params['width'] * $ratio;
}
switch ($params['type']) {
default:
case 'resize':
......
0% oder .
You are about to add 0 people to the discussion. Proceed with caution.
Bearbeitung dieser Nachricht zuerst beenden!
Bitte registrieren oder zum Kommentieren