From 90f5cb23f211c951b49914a0d4d0a7c1090d16f6 Mon Sep 17 00:00:00 2001 From: Michael Vogel Date: Sun, 10 Apr 2016 13:36:26 +0200 Subject: [PATCH] fbrowser: Take the picture as that mostly fits --- mod/fbrowser.php | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/mod/fbrowser.php b/mod/fbrowser.php index 5836efbe52..110ca9585c 100644 --- a/mod/fbrowser.php +++ b/mod/fbrowser.php @@ -74,9 +74,9 @@ 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'])); + // Take the largest picture that is smaller or equal 640 pixels + $p = q("SELECT `scale` FROM `photo` WHERE `resource-id` = '%s' AND `height` <= 640 AND `width` <= 640 ORDER BY `resource-id`, `scale` LIMIT 1", + dbesc($rr['resource-id'])); if ($p) $scale = $p[0]["scale"]; else