includes/functions.php
changeset 906 c949e82b8f49
parent 898 c75754f5b1da
child 909 94c1ff984286
--- a/includes/functions.php	Mon Apr 13 12:32:36 2009 -0400
+++ b/includes/functions.php	Mon Apr 13 14:43:28 2009 -0400
@@ -2155,6 +2155,27 @@
 }
 
 /**
+ * Generate HTML for a sprite image.
+ * @param string Path to sprite image
+ * @param int Width of resulting image
+ * @param int Height of resulting image
+ * @param int X offset
+ * @param int Y offset
+ * @return object HTMLImageElement
+ */
+
+function gen_sprite($path, $width, $height, $xpos, $ypos)
+{
+  $html = '<img src="' . scriptPath . '/images/spacer.gif" width="' . $width . '" height="' . $height . '" ';
+  $xpos = ( $xpos == 0 ) ? '0' : '-' . strval($xpos);
+  $ypos = ( $ypos == 0 ) ? '0' : '-' . strval($ypos);
+  $html .= 'style="background-image: url(' . $path . '); background-repeat: no-repeat; background-position: ' . $ypos . 'px ' . $xpos . 'px;"';
+  $html .= ' />';
+  
+  return $html;
+}
+
+/**
  * Portal function allowing spam-filtering plugins.
  * Hooking guide:
  *   - Attach to spam_check