[AppDB] Make admin/adminScreeshots.php display Screenshots (patch 1 of 2)

Tony Lambregts tony.lambregts at gmail.com
Sat Jul 23 15:57:48 CDT 2005


The admin/adminScreenshots.php page does a great job of regenerating thumbnails 
and images of originals with the WineHQ watermark but it did not actualy display 
any screenshots. This series of patches corrects this problem.

Change Log: Add a generic function to make a clickable image.

Files Changed: include/screenshot.php
-------------- next part --------------
Index: include/screenshot.php
===================================================================
RCS file: /home/wine/appdb/include/screenshot.php,v
retrieving revision 1.27
diff -u -r1.27 screenshot.php
--- include/screenshot.php	23 Jun 2005 03:00:10 -0000	1.27
+++ include/screenshot.php	23 Jul 2005 19:49:48 -0000
@@ -381,5 +381,36 @@
         return $hResult;
     }
     return false;
+}
+
+function get_thumbnail($id)
+{
+    $oScreenshot = new Screenshot($id);
+
+    // generate random tag for popup window
+    $randName = generate_passwd(5);
+    // set img tag        
+    $imgSRC  = '<img src="'.apidb_fullurl("appimage.php").
+               '?thumbnail=true&id='.$id.'" alt="'.$oScreenshot->sDescription.
+               '" width="'.$oScreenshot->oThumnailImage->width.
+               '" height="'.$oScreenshot->oThumnailImage->height.'">';
+    $img = '<a href="'.apidb_fullurl("appimage.php").
+           '?id='.$id.
+           '" onclick="javascript:openWin(\''.apidb_fullurl("appimage.php").
+           '?id='.$id.'\',\''.$randName.'\','.
+           $oScreenshot->oScreenshotImage->width.','.
+           ($oScreenshot->oScreenshotImage->height+4).
+           ');return false;">'.$imgSRC.'</a>';
+
+    // set image link based on user pref
+    if ($_SESSION['current']->isLoggedIn())
+    {
+        if ($_SESSION['current']->getpref("window:screenshot") == "no")
+        {
+            $img = '<a href="'.apidb_fullurl("appimage.php").
+                   '?imageId='.$id.'">'.$imgSRC.'</a>';
+        }
+    }
+    return $img;
 }
 ?>


More information about the wine-patches mailing list