Get the App
SLTechnology News&Howtos  ›  Development  › 

How does PHP deal with pictures in bmp format

Shulou Source: shulou.com Published: 2022-06-03 19:30:21 11月12日 Update

This article mainly introduces PHP how to deal with bmp format pictures, has a certain reference value, interested friends can refer to, I hope you can learn a lot after reading this article, the following let Xiaobian take you to understand.

Array ([0] = > 494 [1] = > 260 [2] = > 6 [3] = > width= "494" height= "260" [bits] = > 24 [mime] = > image/x-ms-bmp)

Take a closer look at the array printed above, mime is image/x-ms-bmp, that is, bmp format, the impression that php's gd library does not handle this function, and then I was in the configuration file, as long as mime for this kind of can not be uploaded.

After coming back in the evening, I looked up the relevant methods of php dealing with bmp on the Internet, and finally found it in stackoverflow. The post said that there was an ImageCreateFromBMP method for the function comments on imagecreate that entered the official website. First, the file in bmp format was called to this function, and then saved with imagejpeg. Later, I tried it and found that imagepng was also fine. The code is posted below.

Tags: Formats processing articles functions pictures files methods that is code value interests impressions at the same time posts arrays more friends knowledge editing industry Apple Docker Huawei Linux macOS MariaDB Microsoft MySQL NVidia OPPO Reno vpn NVidia Huawei Microsoft Redmi