Home  >  Article  >  Backend Development  >  What should I do if php cannot display images?

What should I do if php cannot display images?

藏色散人
藏色散人Original
2020-07-25 09:50:033897browse

Solution to the problem that php cannot display pictures: 1. Remove the semicolon before "extension=php_gd2.dll" in the "php.ini" file; 2. Set "extension_dir" correctly; 3. Put the file Save in "utf8 no bom" format.

What should I do if php cannot display images?

Recommended: "PHP Tutorial"

PHP dynamically generated pictures cannot be displayed

Test code:

If the picture cannot be displayed, it may be the following problem:

1. The semicolon before the code extension=php_gd2.dll in the php.ini file Not removed.

2. extension_dir is not set correctly. The correct setting should be like this: extension_dir = "E:/Project/Web/php5.3/ext"

3. Regarding file encoding, the file should be saved in utf8 no bom format. Here is some information about bom. Explanation:

----------------Note-----------------------

UTF-8 encoded files can be divided into two formats: no BOM and BOM

What is BOM? The three bytes "EF BB BF" are called BOM, and the full name of BOM is "Byte Order" Mard". BOM is commonly used in UTF-8 files to indicate that the file is a UTF-8 file, and the original meaning of BOM is used to represent high and low byte sequences in UTF16.

There is a BOM before the byte stream, which means that the low byte sequence is used (the low byte is in front), and utf8 does not need to consider the byte sequence, so in fact, it can be used with or without BOM.

Microsoft Notepad, Word, etc. can only correctly open UTF8 files containing BOM, but UltraEdit does the opposite, mistaking BOMutf8 files for ascii encoding.

The problem is finally solved, I am happy... .... 

The above is the detailed content of What should I do if php cannot display images?. 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