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.
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.
This example describes how to obtain the type and extension of php image processing functions. 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 "file opening failed, or the specified file is not an image file"; // output error message
}
I hope this article will help you with PHP programming.