mirror of
https://github.com/friendica/friendica
synced 2024-11-09 23:02:54 +00:00
Merge pull request #12398 from MarekBenjamin/image-grid-fixes
Fixed image grid when exactly ONE portrait and ONE landscape is attached
This commit is contained in:
commit
ed805d1af2
1 changed files with 16 additions and 7 deletions
|
@ -3175,16 +3175,25 @@ class Item
|
|||
// Mix of landscape and portrait images.
|
||||
if ($lcount == $pcount) {
|
||||
// equal amount of landscapes and portraits
|
||||
if ($lcount == 1) {
|
||||
// one left / one right
|
||||
$images_fc[] = $landscapeimages[0];
|
||||
$images_sc[] = $portraitimages[0];
|
||||
} else {
|
||||
// Distribute equal to both columns
|
||||
for ($l = 0; $l < $lcount; $l++) {
|
||||
if ($l % 2 == 0) {
|
||||
// landscape left and portrait right for even numbers
|
||||
$images_fc[] = $landscapeimages[$l];
|
||||
$images_fc[] = $portraitimages[$l];
|
||||
} else {
|
||||
// portraits left and landscape right for odd numbers
|
||||
$images_sc[] = $portraitimages[$l];
|
||||
$images_sc[] = $landscapeimages[$l];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if ($lcount > $pcount) {
|
||||
// More landscapes than portraits
|
||||
$p = 0;
|
||||
|
|
Loading…
Reference in a new issue