X-Git-Url: https://jasonwoof.com/gitweb/?a=blobdiff_plain;ds=sidebyside;f=format.php;h=d058631cdd1885c881c44a5a5d755f409b0f153d;hb=a09e0b5b03f95291c9508dd28a2e682ea9fb1f88;hp=99a67b72a70210b00ad2223a33a8a6b858f6e4cc;hpb=d316a446dc9d897a4965727ac76aa40d61818a2c;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);