mirror of
https://github.com/friendica/friendica
synced 2025-04-22 21:10:10 +00:00
Add height allocation support for single images smaller than the available width
This commit is contained in:
parent
c4657c4661
commit
06818a96c3
4 changed files with 22 additions and 10 deletions
|
@ -3356,6 +3356,7 @@ class Item
|
|||
'attachment' => $attachment,
|
||||
],
|
||||
'$allocated_height' => Media::getAllocatedHeightByMedia($attachment),
|
||||
'$allocated_max_width' => ($attachment['preview-width'] ?? $attachment['width']) . 'px',
|
||||
]);
|
||||
}, $s);
|
||||
}
|
||||
|
@ -3472,8 +3473,10 @@ class Item
|
|||
|
||||
if ($attachment['filetype'] == 'image') {
|
||||
$preview_url = Post\Media::getPreviewUrlForId($attachment['id'], ($attachment['width'] > $attachment['height']) ? Proxy::SIZE_MEDIUM : Proxy::SIZE_LARGE);
|
||||
$attachment['preview-width'] = ($attachment['width'] > $attachment['height']) ? Proxy::PIXEL_MEDIUM : Proxy::PIXEL_LARGE;
|
||||
} elseif (!empty($attachment['preview'])) {
|
||||
$preview_url = Post\Media::getPreviewUrlForId($attachment['id'], Proxy::SIZE_LARGE);
|
||||
$attachment['preview-width'] = Proxy::PIXEL_LARGE;
|
||||
} else {
|
||||
$preview_url = '';
|
||||
}
|
||||
|
@ -3529,6 +3532,7 @@ class Item
|
|||
$media = Renderer::replaceMacros(Renderer::getMarkupTemplate('content/image.tpl'), [
|
||||
'$image' => $images[0],
|
||||
'$allocated_height' => Media::getAllocatedHeightByMedia($images[0]['attachment']),
|
||||
'$allocated_max_width' => ($images[0]['attachment']['preview-width'] ?? $images[0]['attachment']['width']) . 'px',
|
||||
]);
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue