PHP imagejpeg() problems

ε祈祈猫儿з 提交于 2019-12-13 03:58:59

问题


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.

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?


回答1:


First I would see if the PHP install contains all the libgd stuff you need for imagejpeg().

You can check like this:

$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";
}

Make sure you see some jpeg stuff listed, if there is none you need some dependent libraries installed.



来源:https://stackoverflow.com/questions/2032111/php-imagejpeg-problems

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!