JasonWoof Got questions, comments, patches, etc.? Contact Jason Woofenden
added: format_h_w_image()
authorjason <jason@lappy.(none)>
Wed, 13 Feb 2008 21:05:28 +0000 (16:05 -0500)
committerjason <jason@lappy.(none)>
Wed, 13 Feb 2008 21:05:28 +0000 (16:05 -0500)
format.php

index 99a67b7..d058631 100644 (file)
@@ -87,6 +87,20 @@ function format_filename($str) {
        return ereg_replace('^[.-]', '_', $str);
 }
 
+function format_h_w_image($str) {
+       $fields = explode(' ', $str);
+       if(count($fields) != 3) {
+               return '';
+       }
+
+       list($width, $height, $filename) = $fields;
+       $width = format_int_0($width);
+       $height = format_int_0($height);
+       $filename = format_filename($filename);
+
+       return "$width $height $filename";
+}
+
 function format_varname($str) {
        $str = strtolower($str);
        $str = ereg_replace('[^a-z0-9_]', '_', $str);