How to use PHP load Image imagecreatefrom_gif_jpeg_png Series functions
The purpose of this article is to share with you about how to use PHP load image imagecreatefrom_gif_jpeg_png series functions. The editor thinks it is very practical, so share it with you as a reference and follow the editor to have a look.
The details are as follows:
The imagecreatefrom series functions are used to load an image from a file or URL.
Load Ima
The imagecreatefrom series functions are used to load an image from a file or URL and return the image resource successfully or an empty string if it fails.
This series of functions are:
Imagecreatefromgif (): create a canvas and load an image from a GIF file or URL address
Imagecreatefromjpeg (): create a canvas and load an image from a JPEG file or URL address
Imagecreatefrompng (): create a canvas and load an image from a PNG file or URL address
Imagecreatefromwbmp (): create a canvas and load an image from a WBMP file or URL address
Imagecreatefromstring (): create a canvas and create a new image from the image stream in the string
Syntax:
Resource imagecreatefromgif (string filename) resource imagecreatefromjpeg (string filename) resource imagecreatefrompng (string filename) resource imagecreatefromwbmp (string filename) resource imagecreatefromstring (string image)
Example:
In this example, we load and output the original image. Since PHP does not have friendly error tips for image creation errors, we have customized the error handling information.
Prompt
For images generated by PHP, if you want to display them directly in a normal web page instead of outputting them through header, you can call them as follows:
Thank you for reading! On "PHP loaded image imagecreatefrom_gif_jpeg_png series of functions how to use" this article is shared here, I hope the above content can be of some help to you, so that you can learn more knowledge, if you think the article is good, you can share it out for more people to see it!