PHP生成縮略圖函數

function?img_create_small($big_img,?$width,?$height,?$small_img)?{?// 大圖文件地址,縮略寬,縮略高,小圖地址
$imgage?=?getimagesize($big_img);?//獲取大圖信息
switch?($imgage[2])?{?// 判斷圖像類型
case?1:
$im?=?imagecreatefromgif($big_img);
break;
case?2:
$im?=?imagecreatefromjpeg($big_img);
break;
case?3:
$im?=?imagecreatefrompng($big_img);
break;
}
$src_W?=?$imgage[0];?//獲取大圖寬
$src_H?=?$imgage[1];?//獲取大圖高
$tn?=?imagecreatetruecolor($width,?$height);?//創建小圖
imagecopyresampled($tn,?$im,?0,?0,?0,?0,?$width,?$height,?$src_W,?$src_H);?//復制圖像并改變大小
imagejpeg($tn,?$small_img);?//輸出圖像
}

轉載于:https://www.cnblogs.com/gaohj/p/3165289.html

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/274170.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/274170.shtml
英文地址,請注明出處:http://en.pswp.cn/news/274170.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

shields 徽標_到處都有平面徽標

shields 徽標重點 (Top highlight)Companies invest a lot of time, money and energy trying to make audiences remember their logos and associate higher value with it. The end goal is to make customers pick their brand over another brand. 公司投入了大量的時間&a…

jquery錨點連接劃動滾動條,再也不用a標簽name 了

$("html,body").animate({ scrollTop: $(".reviews_list").children("ul").children("li").children("b:last").offset().top }, 1000); 轉載于:https://www.cnblogs.com/gxmaspx/p/3169931.html

登錄,注冊,登錄,登錄..?

Last year I found myself in an interesting conversation about which copy to use for a website’s sign up journey. And it wasn’t the first time. Often this devolves into an opinion-based discussion among stakeholders of the ‘what-I-like-based-on-no-eviden…

未完成的控件

using System; using System.ComponentModel; using System.Drawing; using System.Drawing.Drawing2D; using System.Windows.Forms;namespace ImageControls {/// <summary>/// 控件/// </summary> public class ShapeEx : Control{#region 字段private Color _B…

ux設計_UX設計101:

ux設計這是什么&#xff1f; (What is this?) This session is part of a learning curriculum that I designed to incrementally skill up and empower a team of Designers and Researchers whose skillset and ways of working needed to evolve to keep up with changes …

ASP.NET 文件上傳于下載

本文主要介紹一下&#xff0c;在APS.NET中文件的簡單上傳于下載&#xff0c;上傳是將文件上傳到服務器的指定目錄下&#xff0c;下載是從存入數據庫中的路徑&#xff0c;從服務器上下載。 1.上傳文件 (1)頁面代碼 <table align"center" cellpadding"0" …

idea重要插件代碼顏色_顏色在您的網站上的重要性和品牌形象

idea重要插件代碼顏色Choosing the right colors for a website or a logo can be a perplexing and time-consuming task, unless you have the right knowledge of colors. Colors play a pivotal role in the success of some businesses and can make a huge impact on the…

【自己給自己題目做】之一:橢圓可點擊區域

【題一】請實現以下需求&#xff0c;要做一個活動頁面&#xff0c;頁面上有一張圖片&#xff08;假設是800x600&#xff09;&#xff0c;圖片正中心有一個橢圓形的可點擊區域&#xff0c;假設橢圓長軸為200px&#xff08;橫向&#xff09;&#xff0c;短軸160px&#xff08;縱向…

軟件設計師中級 百度知道_設計師應該知道什么

軟件設計師中級 百度知道… and no, it doesn’t have to be how to code.……而且&#xff0c;不必一定要編碼。 Here are a few points that have helped me assess what technical knowledge is necessary for designers to be successful.以下幾點幫助我評估了設計師成功所…

看看清華的同學在四年的大學中干什么吧,非常值得學習

&#xff08;一&#xff09; 永遠不要說你已經盡力了 我在高中時體育特別差&#xff0c;跑1000米都很要命&#xff0c;從來都是不及格。到了清華之后&#xff0c;第一節體育課&#xff0c;老師告訴我們每年要測3000米長跑&#xff0c;跑不過不許畢業&#xff0c;取消推研資格。…

信息保真度準則_設計保真度的新的非科學公式

信息保真度準則As designers, our audience is more than just our users. We keep our user’s needs top of mind while designing for their jobs-to-be-done, but sometimes we need to illustrate the problem and articulate solutions to a broader audience: our cross…

zend studio配置調試(Xdebug方式)

1.下載xdebug http://xdebug.org/download.php 我下的是PHP 5.4 VC9 (32 bit) 【當前系統php是php5.4.14(win32)版本】 2.配置php.ini 在文件最后配置 [Xdebug]zend_extension "C:/php5.4.14/ext/php_xdebug-2.2.3-5.4-vc9.dll" xdebug.auto_trace1xdebug.collect_p…

人物肖像速寫_肖像學的基礎

人物肖像速寫More in the iconography series:? 7 Principles of Icon Design? 5 Ways to Create a Settings Icon? Icon Grids & Keylines Demystified? Pixel-Snapping in Icon Design? 3 Classic Icon FamiliesAn icon is a compact symbol that represents a disc…

python處理網絡文字流,設置為utf8編碼

import sysreload(sys)sys.setdefaultencoding(utf8)在python編程時&#xff0c;如果數據來自客戶端傳過來&#xff0c;在使用"%s" % str和json.loads(str)時&#xff0c;會遇到問題。問題的原因是字符集和編碼的問題。以上代碼可以解決這個問題。 轉載于:https://ww…

產品設計的Kawaiization

重點 (Top highlight)在過去的一兩年中&#xff0c;我注意到品牌和產品設計中出現了某種風格。 (Over the last year or two, I’ve noticed a certain style emerge in brand and product design.) (this article originally appeared on DESK magazine)(本文最初出現在DESK雜…

寫了兩個簡單的小工具,文件夾文件操作的

一&#xff0c;文件夾A下的文件夾下的文件&#xff0c;移到文件夾A下。 二&#xff0c;經常上貼吧什么的&#xff0c;有些圖貼&#xff0c;會直接網頁全部保存為&#xff0c;結果是一個html文件&#xff0c;和引用資源的文件夾&#xff0c;文件夾下有很多無用的文件&#xff0c…

前置聲明相關

前置聲明相關 一個前置聲明是指在程序員尚未給出完整定義之前對一個標示符(一個類型、一個變量或者一個函數)的聲明。一個很簡單的例子就是我們在函數A中使用了函數B&#xff0c;但是函數B的聲明在函數A之后&#xff0c;這個時候&#xff0c;就需要對函數B進行前置聲明&#xf…

陌生人社會_陌生人之旅

陌生人社會The Last of Us Part II is a game that is deeply invested in the minutiae of its characters. The pain they cause, the things that drive them, and the particularities of their self-destruction and salvation. The game’s commitment to the true natur…

設計師更高效_要成為更好的設計師,我們需要更多的時間進行游戲

設計師更高效重點 (Top highlight)I’m a busy designer. I’m fortunate to be booked out months in advance. My freelance career has proven more stable than other’s “jobs”. I don’t wear busy as a badge of honour. I don’t condone hustle culture or compare …

java數據類型及其說明

Java數據類型及其說明java基本數據類型&#xff1a; java數據類型分為基本數據類型和引用數據類型&#xff0c;基本數據類型就是4類8種&#xff0c;分為數值類型&#xff08;整數型[byte&#xff0c;short&#xff0c;int&#xff0c;long]&#xff09;&#xff0c;字符型&…