我有一个可以在我的小型共享主机上使用的图像上传脚本,但是当我切换到Virt Ded时,它立即停止了工作.经过一番研究,我确定罪魁祸首是PHP函数imagejpeg()-这是脚本中的最后一部分代码.
I had an image upload script that worked on my little shared hosting, but just as I switched to Virt Ded, it immediately stopped working. After some research I determined the culprit to be the PHP function imagejpeg() - which was the last bit of code in the script.
它允许我将null指定为文件路径(在这种情况下,它将打印到屏幕上),但是不允许我输入任何文件路径而不返回false.
It allows me to specify null as the filepath (in which case it prints it to the screen), but does not allow me to enter ANY filepath without return false.
有人知道发生了什么事吗?
Anybody know what is going on?
推荐答案首先,我将了解PHP安装中是否包含imagejpeg()所需的所有libgd内容.
First I would see if the PHP install contains all the libgd stuff you need for imagejpeg().
您可以像这样检查:
$extensions = get_loaded_extensions(); if( !in_array( 'gd', $extensions ) ) { die "libgd is not loaded"; }如果这样做很好,您可以执行以下操作:
If that's good to go you can do something like:
$gd = gd_info(); while( list( $k, $v ) = each( $gd ) ) { echo "$k: $v"; }请确保您列出了一些jpeg内容,如果没有,则需要安装一些依赖库.
Make sure you see some jpeg stuff listed, if there is none you need some dependent libraries installed.
更多推荐
PHP imagejpeg()问题
发布评论