[AppDB] appimage, handle empty parameters

Paul van Schayck info at wwwdesign.tmfweb.nl
Wed Mar 24 14:57:04 CST 2004


Previous patch broke displaying full images. This should fix it again

Regards,
Paul

Changelog:
Check $width $height input. Display full image if no $width $height given

Index: appimage.php
===================================================================
RCS file: /home/wine/appdb/appimage.php,v
retrieving revision 1.2
diff -u -r1.2 appimage.php
--- appimage.php	24 Mar 2004 15:49:39 -0000	1.2
+++ appimage.php	24 Mar 2004 20:53:55 -0000
@@ -38,6 +38,13 @@
 
 opendb();
 
+// We have input, but wrong input
+if( ( $width AND !is_numeric($width) ) || ( $height AND !is_numeric($height) ) )
+{
+	$width = 100;
+	$height = 75;
+}
+
 if($imageId AND is_numeric($imageId) )
     $result = mysql_query("SELECT * FROM appData WHERE id = $imageId");
 
@@ -82,6 +89,11 @@
     // do scaling
     $sim = ImageCreate($width, $height);
     ImageCopyResized($sim, $im, 0, 0, 0, 0, $width, $height, ImageSX($im), ImageSY($im));
+}
+else
+{
+	// display full image
+	$sim = $im;
 }
 
 // output the image




More information about the wine-patches mailing list