getimagesize 适用于某些图像,但不适用于其他图像
我有以下脚本,它使用 PHP 5.2.6 返回本地服务器上图像的高度和宽度,但不返回使用 5.2.17 的共享托管帐户上的图像的高度和宽度。
ini_set('memory_limit', '32M');
list($width, $height, $type, $attr) = getimagesize("http://images.jcrew.com/erez4/erez?src=images/eiec/39/39251/39251_WO7826.tif&tmp=prdAr3");
echo "<img src=\"http://images.jcrew.com/erez4/erez?src=images/eiec/39/39251/39251_WO7826.tif&tmp=prdAr3\" $attr alt=\"getimagesize() example\" />";
我尝试按照另一个问题中的建议增加 memory_limit
。从其他站点获取图像的大小在本地和远程都可以正常工作,但对于此站点来说,只能在本地进行。可能发生了什么?
I have the following script that returns the height and width of the image on my local server using PHP 5.2.6, but not on my shared hosting account using 5.2.17.
ini_set('memory_limit', '32M');
list($width, $height, $type, $attr) = getimagesize("http://images.jcrew.com/erez4/erez?src=images/eiec/39/39251/39251_WO7826.tif&tmp=prdAr3");
echo "<img src=\"http://images.jcrew.com/erez4/erez?src=images/eiec/39/39251/39251_WO7826.tif&tmp=prdAr3\" $attr alt=\"getimagesize() example\" />";
I tried increasing the memory_limit
as was suggested in another question. Getting the sizes of images from other sites works fine both locally and remotely, but for this site, only locally. What might be going on?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
听起来您的共享主机可能已禁用
allow_url_fopen
。如果您还没有配置,您应该配置错误日志记录并确保您没有在脚本中禁用错误报告。它可能会向您提供一条错误消息,以表明失败的原因。It sounds like your shared hosting may have
allow_url_fopen
disabled. If you haven't already, you should configure error logging and make sure you're not disabling error reporting in your scripts. It's probably giving you an error message to indicate why it is failing.检查是否
allow-url-fopen< /code>
已禁用。
Check whether
allow-url-fopen
is disabled.