]> git.mxchange.org Git - friendica.git/commitdiff
fbrowser: Take the picture as that mostly fits
authorMichael Vogel <icarus@dabo.de>
Sun, 10 Apr 2016 11:36:26 +0000 (13:36 +0200)
committerRoland Haeder <roland@mxchange.org>
Sun, 1 May 2016 11:47:24 +0000 (13:47 +0200)
mod/fbrowser.php

index 5836efbe5290437741a04b9b201ecf84b5b6e58b..110ca9585c9d2e5ff0e346aaf4ad4328afffadd7 100644 (file)
@@ -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