return ereg_replace('^[.-]', '_', $str);
}
+function format_path($str, $allow_uppercase = false) {
+ if(!$allow_uppercase) {
+ $str = strtolower($str);
+ }
+ $str = ereg_replace('[^a-zA-Z0-9_./-]', '_', $str);
+ return ereg_replace('^[.-]', '_', $str);
+}
+
function client_path_to_filename($path) {
$filename = ereg_replace(".*[:/\\]", '', $path);
return format_filename($filename, true);
}
-function format_h_w_image($str) {
+function format_image_w_h($str) {
$fields = explode(' ', $str);
if(count($fields) != 3) {
return '';
}
- list($width, $height, $filename) = $fields;
+ list($filename, $width, $height) = $fields;
+ $filename = format_path($filename);
+ $width = format_int_0($width);
+ $height = format_int_0($height);
+
+ return "$filename $width $height";
+}
+
+function format_image_w_h_thumb_w_h($str) {
+ $fields = explode(' ', $str);
+ if(count($fields) != 6) {
+ die('count: ' . count($fields));
+ return '';
+ }
+
+ list($filename, $width, $height, $thumb_filename, $thumb_width, $thumb_height) = $fields;
+ $filename = format_path($filename);
$width = format_int_0($width);
$height = format_int_0($height);
- $filename = format_filename($filename);
+ $thumb_filename = format_path($thumb_filename);
+ $thumb_width = format_int_0($thumb_width);
+ $thumb_height = format_int_0($thumb_height);
- return "$width $height $filename";
+ return "$filename $width $height $thumb_filename $thumb_width $thumb_height";
}
function format_varname($str) {