X-Git-Url: https://git.immae.eu/?a=blobdiff_plain;f=index.php;h=9dd6483eee9750f81e653cdc4c6edad4be18b487;hb=96bc4efe9ea9ed513d1ec06e0823847d5eebe82f;hp=46a8c9021b07b78eecc0ba08a289ffba3c8aac8e;hpb=51788ab8bacfe5fe951531ef545913ff6983f1b8;p=github%2Fshaarli%2FShaarli.git diff --git a/index.php b/index.php index 46a8c902..9dd6483e 100644 --- a/index.php +++ b/index.php @@ -1,5 +1,5 @@ $link) { // Roughly estimate length of entry (by counting characters) - $length=strlen($link['title'])+strlen($link['description']); - if ($link['thumbnail']) $length +=100; // 1 thumbnails roughly take as much space as 100 words; - + // Title: 30 chars = 1 line. 1 line is 30 pixels height. + // Description: 836 characters gives roughly 342 pixel height. + // This is not perfect, but it's usually ok. + $length=strlen($link['title'])+(342*strlen($link['description']))/836; + if ($link['thumbnail']) $length +=100; // 1 thumbnails roughly takes 100 pixels height. // Then put in column which is the less filled: $smallest=min($fill); // find smallest value in array. $index=array_search($smallest,$fill); // find index of this smallest value.