Imagecreatefromjpeg returns a black image after resize

后端 未结 2 1064
情深已故
情深已故 2021-01-27 15:49

I have a script to resize an uploaded image, but when I use it, it just returns a black square. All error messages are pointing at this function:

function resize         


        
2条回答
  •  不思量自难忘°
    2021-01-27 16:23

    1. Check if the imagecreatetruecolor succeeded. If the new image is "large" it could exceed the PHP memory_limit. This function returns FALSE if it failed for any reason.
    2. Ditto with imagecreatefromjpeg(). The two individual images may fit within the memory limit but together could be too large. The source image may also not exist. This function returns FALSE if it failed for any reason
    3. Check if the imagecopyresampled() failed - it also returns FALSE on failure.
    4. Check if imagejpeg() failed - maybe you don't have write permissions on whatever file you're specifying in $image. And again, this function returns FALSE on failure.

提交回复
热议问题