Home > Article > Backend Development > How to solve php imagepng error problem
## The operating environment of this article: Windows 7 system, PHP version 7.1 , DELL G3 computerphp imagepng reports an error because the quality range of the image generated by ImagePNG is from 0 to 9. When parameters outside this range are passed in, the function will not work. The solution is to change the value to 0 to 9. , the error will disappear on its own.
How to solve the php imagepng error problem?
php error when uploading pictures: gd-png error: compression level must be 0 through 9imagejpeg($imgSource, $path, 100);The reason for this error is because the quality of the image generated by ImagePNG ranges from 0 to 9. If the parameters passed in are outside this range, the function will not work. So, simply change the value to between 0 and 9 and the error will go away on its own.
imagepng($imgSource, $path, 9);Recommended study: "
PHP Video Tutorial"
The above is the detailed content of How to solve php imagepng error problem. For more information, please follow other related articles on the PHP Chinese website!