php生成圖片縮略圖的方法_PHP教程
教程Tag:暫無Tag,歡迎添加,賺取U幣!
推薦:php獲取網(wǎng)頁里所有圖片并存入數(shù)組的方法本文實例講述了php獲取網(wǎng)頁里所有圖片并存入數(shù)組的方法。分享給大家供大家參考。具體如下: 希望本文所述對大家的php程序設(shè)計有所幫助。
這篇文章主要介紹了php生成圖片縮略圖的方法,涉及php操作圖片的技巧,非常具有實用價值,需要的朋友可以參考下
本文實例講述了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);
- }
分享:經(jīng)典PHP加密解密函數(shù)Authcode()修復(fù)版代碼Authcode這個函數(shù)很多人都使用,這函數(shù)來自Discuz程序,用于加密解密字符串,可以設(shè)置鑰匙(key)和過期時間,在很多時候都用得著。原版的函數(shù)代碼可能會生成+、/、這樣的字符,導(dǎo)致通過URL傳值取回時被轉(zhuǎn)義,導(dǎo)致無法解密。火端網(wǎng)絡(luò)稍加修改,把這幾個字符替換成其它
相關(guān)PHP教程:
- php生成圓角圖片的方法
- php按單詞截取字符串的方法
- php生成zip文件類實例
- php獲取網(wǎng)頁里所有圖片并存入數(shù)組的方法
- 經(jīng)典PHP加密解密函數(shù)Authcode()修復(fù)版代碼
- php簡單實現(xiàn)快速排序的方法
- php獲取網(wǎng)頁上所有鏈接的方法
- php將HTML表格每行每列轉(zhuǎn)為數(shù)組實現(xiàn)采集表格數(shù)據(jù)的方法
- PHP常用處理靜態(tài)操作類
- php使用post數(shù)組的鍵值創(chuàng)建同名變量并賦值的方法
- php刪除指定目錄的方法
- WordPress博客程序常見錯誤的解決方法
- 相關(guān)鏈接:
- 教程說明:
PHP教程-php生成圖片縮略圖的方法。