php生成圖片縮略圖的方法_PHP教程

      編輯Tag賺U幣
      教程Tag:暫無Tag,歡迎添加,賺取U幣!

      推薦:php獲取網頁里所有圖片并存入數組的方法
      本文實例講述了php獲取網頁里所有圖片并存入數組的方法。分享給大家供大家參考。具體如下: 希望本文所述對大家的php程序設計有所幫助。

      這篇文章主要介紹了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); 

      分享:經典PHP加密解密函數Authcode()修復版代碼
      Authcode這個函數很多人都使用,這函數來自Discuz程序,用于加密解密字符串,可以設置鑰匙(key)和過期時間,在很多時候都用得著。原版的函數代碼可能會生成+、/、這樣的字符,導致通過URL傳值取回時被轉義,導致無法解密。火端網絡稍加修改,把這幾個字符替換成其它

      來源:模板無憂//所屬分類:PHP教程/更新時間:2015-04-08
      相關PHP教程