在共享服务器上禁用 getimagesize () 的替代方案是什么
当我在作为共享服务器的托管公司中使用 getimagesize() 时,出现以下错误。
Message: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration
Filename: admin/admin_product_home.php
获取图像的图像大小的替代方法是什么?
提前致谢。
echo "<tr>\n";
echo "<td>".$list."</td>\n";
$filepath = base_url()."uploads/".$list;
echo "<td><img width=\"70px\" src='".$filepath."' /></td>";
echo "<td>";
$filesize = getimagesize($filepath);
echo "width: ".$filesize[0]. "px<br />";
echo "height: ".$filesize[1]. "px<br />";
echo "</td>";
echo "<td>";
...
...
我正在使用 codeigniter,正如您在 base_url() 中看到的那样。
When I use getimagesize() in my hosting company which is a shared server, I get the following error.
Message: getimagesize() [function.getimagesize]: URL file-access is disabled in the server configuration
Filename: admin/admin_product_home.php
What is the alternative to get the image size of images?
Thanks in advance.
echo "<tr>\n";
echo "<td>".$list."</td>\n";
$filepath = base_url()."uploads/".$list;
echo "<td><img width=\"70px\" src='".$filepath."' /></td>";
echo "<td>";
$filesize = getimagesize($filepath);
echo "width: ".$filesize[0]. "px<br />";
echo "height: ".$filesize[1]. "px<br />";
echo "</td>";
echo "<td>";
...
...
I am using codeigniter as you can see in base_url().
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
问题不在于
getimagesize
,而在于您尝试打开的文件名。看起来您在
getimagesize()
调用中使用了http://
URL,尽管您引用的文件名另有说明。确保您使用的是本地文件路径。
编辑:创建一个不带
base_url()
的文件路径变量,并在前面添加正确的文件系统路径。The problem isn't with
getimagesize
but with the file name you are trying to open.It looks like you're using a
http://
URL in thegetimagesize()
call, despite the file name you quote saying otherwise.Make sure you are using a local file path.
Edit: Create a file path variable without
base_url()
and prepend the correct filesystem path.