From: jason Date: Wed, 13 Feb 2008 21:05:28 +0000 (-0500) Subject: added: format_h_w_image() X-Git-Url: https://jasonwoof.com/gitweb/?p=wfpl.git;a=commitdiff_plain;h=b7394a3a8379c423f6293fd343e6e4ef32d990ed added: format_h_w_image() --- diff --git a/format.php b/format.php index 99a67b7..d058631 100644 --- a/format.php +++ b/format.php @@ -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);