X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;f=format.php;h=d058631cdd1885c881c44a5a5d755f409b0f153d;hb=b7394a3a8379c423f6293fd343e6e4ef32d990ed;hp=99a67b72a70210b00ad2223a33a8a6b858f6e4cc;hpb=277f0431cc57acc1b77c1fbe733c40e9ba90d710;p=wfpl.git 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);