欧美bbbwbbbw肥妇,免费乱码人妻系列日韩,一级黄片

php圖片處理函數(shù)獲取類型及擴(kuò)展名實(shí)例

 更新時(shí)間:2014年11月19日 09:37:36   投稿:shichen2014  
這篇文章主要介紹了php圖片處理函數(shù)獲取類型及擴(kuò)展名的方法,包括image2wbmp、image_type_to_extension、image_type_to_mime_type等函數(shù)的具體使用,具有不錯(cuò)的借鑒與學(xué)習(xí)價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了php圖片處理函數(shù)獲取類型及擴(kuò)展名的方法。分享給大家供大家參考。

具體實(shí)現(xiàn)代碼如下:

復(fù)制代碼 代碼如下:
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ù)暫無文檔
 
$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ò)誤信息
}

希望本文所述對大家的PHP程序設(shè)計(jì)有所幫助。

相關(guān)文章

最新評論