From: Michael Vogel Date: Sun, 20 Mar 2016 09:30:06 +0000 (+0100) Subject: Take the second largest picture as preview - not the smallest one X-Git-Url: https://git.mxchange.org/?a=commitdiff_plain;h=186eaf1264320de3e5604d09b7ae7818ba5c4465;p=friendica.git Take the second largest picture as preview - not the smallest one --- diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 0a2a7dead5..5836efbe52 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -74,10 +74,18 @@ function fbrowser_content($a){ $filename_e = $rr['filename']; } + // Take the second largest picture as preview + $p = q("SELECT `scale` FROM `photo` WHERE `resource-id` = '%s' AND `scale` > %d ORDER BY `resource-id`, `scale` LIMIT 1", + dbesc($rr['resource-id']), intval($rr['hiq'])); + if ($p) + $scale = $p[0]["scale"]; + else + $scale = $rr['loq']; + return array( $a->get_baseurl() . '/photos/' . $a->user['nickname'] . '/image/' . $rr['resource-id'], $filename_e, - $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $rr['loq'] . '.'. $ext + $a->get_baseurl() . '/photo/' . $rr['resource-id'] . '-' . $scale . '.'. $ext ); } $files = array_map("_map_files1", $r);