轉(zhuǎn)載請(qǐng)注明來(lái)源:php 圖片處理函數(shù) 獲取類型 擴(kuò)展名
- image_type=image_type_to_mime_type(imagetype_png); //獲取png的mime類型
- echo $image_type; //輸出結(jié)果
- //
- $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教程 5). image_type_to_extension — 取得圖像類型的文件 后綴 ... warning. 本函數(shù)暫無(wú)文檔
- $file_ext=image_type_to_extension("1.jpg");
- echo $file_ext;
- //
- $filename="1.jpg"; //定義圖像文件
- $size=getimagesize($filename); //獲取圖像的大小
- $fp=fopen($filename,"rb"); //打開文件
- if($size && $fp) //如果成功打開
- {
- header("content-type: {$size['mime']}"); //輸出文件頭信息
- fpassthru($fp); //輸出文件內(nèi)容
- exit; //中止操作
- }
- else
- {
- echo "文件打開失敗,或者指定的不是圖像文件"; //輸出錯(cuò)誤信息
- }//開源代碼phpfensi.com
哈爾濱品用軟件有限公司致力于為哈爾濱的中小企業(yè)制作大氣、美觀的優(yōu)秀網(wǎng)站,并且能夠搭建符合百度排名規(guī)范的網(wǎng)站基底,使您的網(wǎng)站無(wú)需額外費(fèi)用,即可穩(wěn)步提升排名至首頁(yè)。歡迎體驗(yàn)最佳的哈爾濱網(wǎng)站建設(shè)。
