我正在使用调整JPG图像大小的image resizer script。它工作得很好我的远程服务器,但不幸的是它不能在客户端的服务器上工作。 : - |
这些目录是可写的(权限设置为777)。所有我得到的是:
Error: image does not exist: /home/content/u/s/e/username/correct/path/to/existing/file.jpg
下面的代码的位可能在调试帮助:
// Images must be local files, so for convenience we strip the domain if it's there
$image = preg_replace('/^(s?f|ht)tps?:\/\/[^\/]+/i', '', (string) $_GET['image']);
// ...
// Strip the possible trailing slash off the document root
$docRoot = preg_replace('/\/$/', '', DOCUMENT_ROOT);
//...
if (!file_exists($docRoot . $image))
{
header('HTTP/1.1 404 Not Found');
echo 'Error: image does not exist: ' . $docRoot . $image;
exit();
}
请注意,作为一个开发者,我已经获准访问的子目录根目录。
我希望我能清楚地说明问题。我对背后发生的事情感到不知所措。帮助非常令人惊喜
你的'preg_replace'将会因为一个简单的http请求而失败(你只能匹配安全协议,不知道在这种情况下是否有这个问题。 – Brombomb
@brombomb,谢谢你指出。问题,因为它在我的服务器上没有任何问题 – abhisek