Home >Backend Development >PHP Problem >What should I do if the image downloaded by php cannot be displayed?

What should I do if the image downloaded by php cannot be displayed?

藏色散人
藏色散人Original
2020-07-28 10:18:072318browse

The solution to the problem that php downloaded images cannot be displayed: first find and open the corresponding PHP code file; then find the imagepng function part; then add the "ob_clean()" function in front of the imagepng function; finally save the modification file.

What should I do if the image downloaded by php cannot be displayed?

Recommended: "PHP Tutorial"

imagepng cannot display images

It turns out to be php5 Apache2 WinSrv2003, everything is normal. After transplanting to the "PHP5.4 IIS7 WINSRV2008" environment, the picture has not been displayed, only the red cross.

The final solution is: after adding the ob_clean() function before the imagepng() function, the problem disappears.

The specific reasons have not yet been studied in depth, and discussions are welcome.

The above is the detailed content of What should I do if the image downloaded by php cannot be displayed?. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn