最新国产好看的视频,伊人天堂AV在线,国产Aaaaaa视频,蜜臀视频在线观看一区,人妻av色图,密臀久久久精品影片,青青视频免费观看毛片,久草在线观看视,国产三级精品色情在线

php生成圖片縮略圖的方法

 更新時(shí)間:2015年04月07日 11:58:49   作者:不吃皮蛋  
這篇文章主要介紹了php生成圖片縮略圖的方法,涉及php操作圖片的技巧,非常具有實(shí)用價(jià)值,需要的朋友可以參考下

本文實(shí)例講述了php生成圖片縮略圖的方法。分享給大家供大家參考。具體如下:

這里需要用到GD2 library

function make_thumb($src,$dest,$desired_width)
{
 
  /* read the source image */
  $source_image = imagecreatefromjpeg($src);
  $width = imagesx($source_image);
  $height = imagesy($source_image);
  /* find the "desired height" of this thumbnail, relative to the desired width */
  $desired_height = floor($height*($desired_width/$width));
  /* create a new, "virtual" image */
  $virtual_image = imagecreatetruecolor($desired_width,$desired_height);
  /* copy source image at a resized size */
  imagecopyresized($virtual_image,$source_image,0,0,0,0,$desired_width,$desired_height,$width,$height);
  /* create the physical thumbnail image to its destination */
  imagejpeg($virtual_image,$dest, 83);
}

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

相關(guān)文章

最新評(píng)論

安龙县| 武夷山市| 芮城县| 北海市| 白城市| 富阳市| 建德市| 牡丹江市| 平遥县| 河西区| 拜城县| 稻城县| 焦作市| 阜阳市| 库伦旗| 万山特区| 会东县| 玉山县| 定西市| 略阳县| 平罗县| 高雄市| 巧家县| 文成县| 波密县| 会同县| 无极县| 柳江县| 怀来县| 黄陵县| 平武县| 常德市| 观塘区| 沈丘县| 马公市| 婺源县| 灵山县| 教育| 安吉县| 桐柏县| 丹棱县|