This article describes how to obtain the types and extensions of php image processing functions, including image2wbmp, image_type_to_extension, image_type_to_mime_type, and other functions, for more information about how to obtain php image processing functions, see the following example. Share it with you for your reference.
The specific implementation code is as follows:
The code is as follows:
Image_type = image_type_to_mime_type (imagetype_png); // Obtain the mime type of png
Echo $ image_type; // output result
//
$ File = '1.jpg ';
$ Image = imagecreatefromjpeg ($ file );
Header ('content-type: '. image_type_to_mime_type (imagetype_wbmp ));
$ Fp = fopen ($ file, r );
Fpassthru ($ fp );
Image2wbmp ($ image, "1.bmp"); // output the stream directly
// Image_type_to_extension. (php Tutorial 5). image_type_to_extension-get the image-type file suffix... warning. no documentation for this function
$ File_ext = image_type_to_extension ("1.jpg ");
Echo $ file_ext;
//
$ Filename = "1.jpg"; // define an image file
$ Size = getimagesize ($ filename); // Obtain the image size
$ Fp = fopen ($ filename, "rb"); // open the file
If ($ size & $ fp) // if it is enabled successfully
{
Header ("content-type: {$ size ['Mime ']}"); // output file header information
Fpassthru ($ fp); // output file content
Exit; // stop the operation
}
Else
{
Echo "an error occurred while opening the file, or the specified file is not an image file"; // output an error message
}
I hope this article will help you with PHP programming.