PHP imagejpeg() problems
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?
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.
精彩评论