国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 開發 > PHP > 正文

php生成圖片縮略圖的方法

2024-05-04 21:56:05
字體:
來源:轉載
供稿:網友

這篇文章主要介紹了php生成圖片縮略圖的方法,涉及php操作圖片的技巧,非常具有實用價值,需要的朋友可以參考下

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

這里需要用到GD2 library

  1. function make_thumb($src,$dest,$desired_width
  2.    
  3.   /* read the source image */ 
  4.   $source_image = imagecreatefromjpeg($src); 
  5.   $width = imagesx($source_image); 
  6.   $height = imagesy($source_image); 
  7.   /* find the "desired height" of this thumbnail, relative to the desired width */ 
  8.   $desired_height = floor($height*($desired_width/$width)); 
  9.   /* create a new, "virtual" image */ 
  10.   $virtual_image = imagecreatetruecolor($desired_width,$desired_height); 
  11.   /* copy source image at a resized size */ 
  12.   imagecopyresized($virtual_image,$source_image,0,0,0,0,$desired_width,$desired_height,$width,$height); 
  13.   /* create the physical thumbnail image to its destination */ 
  14.   imagejpeg($virtual_image,$dest, 83); 

發表評論 共有條評論
用戶名: 密碼:
驗證碼: 匿名發表
主站蜘蛛池模板: 正宁县| 历史| 莱州市| 黑龙江省| 蒲城县| 大连市| 渭南市| 四子王旗| 旬邑县| 遂宁市| 昌宁县| 石楼县| 兖州市| 综艺| 府谷县| 清新县| 汉寿县| 林西县| 梓潼县| 宁化县| 崇礼县| 菏泽市| 广河县| 平湖市| 普兰店市| 莆田市| 奉节县| 蒲城县| 金溪县| 永川市| 延津县| 宿松县| 鱼台县| 拜泉县| 庆安县| 房产| 乌兰县| 临汾市| 芜湖县| 获嘉县| 麻城市|