<?php
ob_clean();
-list ($height, $imgarg) = explode('/', ltrim($Args, '/'), 2);
+list ($height, $imgpath) = explode('/', ltrim($Args, '/'), 2);
$width= 1000;
-$imgpath = "data/$imgarg";
+$imgpath = preg_replace('{^(?=[0-9]+/)}', 'data/', $imgpath, 1);
if (!file_exists($imgpath)) {
http_response_code(404);
exit;
}
-$target = preg_replace("{^data/}", "thumb/$height/", $imgpath, 1);
+$target = "thumb/$height/$imgpath";
if (!file_exists($target)) {
@mkdir(dirname($target), 0777, TRUE);