Home > Article > Backend Development > PHP implements code to extract an image file and display it on the browser_PHP tutorial
I did a project last year where I wanted to make a text list of image files uploaded by users. When the user clicks on a file name, the image can be displayed.
Because we have to consider compatibility with various image formats, I The GD library is used to determine the specific image file (MINE), and then the corresponding image generation function imagecreatefromXXX() is called to generate an img, and then the img is output to the browser in jpeg format. Although it is done, but I always feel dissatisfied.
Today I had the opportunity to reconsider this function. I found a few lines of code in the php manual. It is concise and clear, and can fully realize the functions I want, and does not require the GD library