第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號(hào)安全,請(qǐng)及時(shí)綁定郵箱和手機(jī)立即綁定

GD庫(kù)實(shí)現(xiàn)圖片水印與縮略圖

難度初級(jí)
時(shí)長(zhǎng) 1小時(shí)41分
學(xué)習(xí)人數(shù)
綜合評(píng)分9.77
106人評(píng)價(jià) 查看評(píng)價(jià)
9.9 內(nèi)容實(shí)用
9.6 簡(jiǎn)潔易懂
9.8 邏輯清晰
  • //2.操作圖片 //2.1設(shè)置字體的路徑 $font = "msyh.ttf"; //2.2填寫我們的水印內(nèi)容 $content = "萌物語moe__1010"; //2.3設(shè)置字體的顏色RGB和透明度:參數(shù)1(內(nèi)存中的圖片),參數(shù)2(顏色) $col = imagecolorallocatealpha($image, 255, 255, 255, 50); //2.4寫入文字 imagettftext($image, 20, 0, 20, 30, $col, $font, $content);
    查看全部
  • //GD庫(kù):給圖片添加文字水印 //1.打開圖片 //1.1配置圖片路徑(就是你想要操作的圖片的路徑) $src = "yellow.jpg"; //1.2獲取圖片信息(通過GD庫(kù)提供的方法,得到你想要處理的圖片的基本信息) $info = getimagesize($src);//把圖片的基本信息賦值給$info變量。 /*echo "<pre>";//能讓打印效果更好看 print_r($info);*/ //1.3通過圖像的編號(hào)來獲取圖像的類型 $type = image_type_to_extension($info[2],false);//不需要.加一個(gè)false參數(shù) //print_r($type);//打印結(jié)果為jpeg //1.4在內(nèi)存中創(chuàng)建一個(gè)和我們圖像類型一樣的圖像 $fun = "imagecreatefrom{$type}"; //1.5把圖片復(fù)制到我們的內(nèi)存中 $image = $fun($src);
    查看全部
  • 素材準(zhǔn)備: 1.原圖片不要用中文命名。 2.使用小圖作為水印。(PNG格式最佳) 3.字體庫(kù),windows有自帶的字體庫(kù)。(微軟雅黑) 4.開啟GD庫(kù):Wamp->打開php.ini->查找gd2->把extension=php_gd2.dll前面的;去掉。保存文件。
    查看全部
    0 采集 收起 來源:素材準(zhǔn)備

    2018-03-22

  • 使用PHP中自帶的GD庫(kù)去處理圖片。 1.在網(wǎng)站上傳圖片的時(shí)候,自動(dòng)給圖片添加水印。 2.壓縮圖片,加快上傳速度。
    查看全部
  • 圖片水印 打開圖片
    查看全部
  • 文字水印 保存圖片 銷毀圖片
    查看全部
  • 文字水印 操作圖片
    查看全部
  • 文字水印 打開圖片
    查看全部
  • GD2圖片處理基本操作步驟: 1.打開圖片,加載圖片到內(nèi)存 2.操作圖片 3.輸出圖片 4.銷毀圖片
    查看全部
  • <?php //open picture $src = "001.jpg"; //get picture info $info = getimagesize($src); //get pirture type for num $type = image_type_to_extension($info[2],false); //build picture in stronge $fun = "imagecreatefrom{$type}"; //copy $image = $fun($src);//as imagecreatefromjpeg($src); //option picture //create width height px pricture $image_thumb = imagecreatetruecolor(200, 150); //copy after pirture in px priture imagecopyresampled($image_thumb,$image,0,0,0,0,200,150,$info[0],$info[1]); //destroy image imagedestroy($image); //show picture in borwer // ob_clean(); $funs = "image{$type}"; header("Content-type:".$info['mime']); $funs($image_thumb); // $funs($image_thumb,"thumb.".$type); //destroy imagedestroy($image_thumb); ?>
    查看全部
  • 代碼段
    查看全部
  • 代碼段
    查看全部
  • 水印圖的完善版,可以完美生成透明水印 /** * 操作圖片(圖片水印) * string $image_Mark 水印地址 * int $x x軸位置 * int $y y軸位置 * int $pct 合并程度 100為完全合并,無透明 */ public function imageMark ($image_Mark,$x=0,$y=0,$pct=100) { $info2=getimagesize($image_Mark); $width=$info2[0];//水印寬 $height=$info2[1];//水印高 $type=image_type_to_extension($info2[2],false); $fun="imagecreatefrom{$type}"; $water=$fun($image_Mark);//創(chuàng)建水印圖 if($pct==100){ imagecopy($this->image,$water,$x,$y,0,0,$width,$height);//無透明 }else{ //1.生成真彩圖 $img = imagecreatetruecolor($width,$height); //2.把原圖畫入畫板 imagecopy($img,$this->image,0,0,$x,$y, $x+$width, $y+$height); //3.在畫板中加入水印 imagecopy($img,$water,0,0,0,0,$width,$height); //4.把畫板中的畫改變透明度后畫入原圖,使得水印有了透明效果 imagecopymerge($this->image,$img,$x,$y,0,0, $width, $height,$pct); imagedestroy($img); } imagedestroy($water);//釋放水印圖內(nèi)存 }
    查看全部
  • //保存圖片 public function save($path){ $funs="image{$this->info['type']}"; $funs($this->image,$path.".".$this->info['type']); } //文字水印 public function fontMark($content,$url,$size,$color,$local,$angle){ $color=imagecolorallocatealpha($this->image,$color[0],$color[1],$color[2],$color[3]); imagettftext($this->image,$size,$angle,$local['x'],$local['y'],$color,$url,$content); } //圖片水印 public function imageMark($source,$local,$alpha){ $info2=getimagesize($source); $type2=image_type_to_extension($info2[2],false); $func2="imagecreatefrom{$type2}"; $water=$func2($source); imagecopymerge($this->image,$water,$local['x'],$local['y'],0,0,$info2[0],$info2[1],$alpha); imagedestroy($water); } //銷毀圖片 public function __destruct(){ imagedestroy($this->image); }
    查看全部
  • <?php class Image{ public $info; private $image; //構(gòu)造函數(shù),打開文檔 public function __construct($src){ $info=getimagesize($src); $this->info=array( 'width'=>$info[0], 'height'=>$info[1], 'type'=>image_type_to_extension($info[2],false), 'mime'=>$info['mime'] ); $fun="imagecreatefrom{$this->info['type']}"; $this->image=$fun($src); } //壓縮圖片 public function thumb($width,$height){ $image_thumb=imagecreatetruecolor($width,$height); imagecopyresampled($image_thumb,$this->image,0,0,0,0,$width,$height,$this->info['width'],$this->info['height']); imagedestroy($this->image); $this->image=$image_thumb; } //顯示 圖片 public function show(){ header("Content-type:".$this->info['mime']); $funs="image{$this->info['type']}"; $funs($this->image); } } ?>
    查看全部

舉報(bào)

0/150
提交
取消
課程須知
學(xué)習(xí)本門課程之前,建議先了解一下知識(shí),會(huì)更有助于理解和掌握本門課程 1、掌握PHP基本的語言語法 2、了解PHP生命周期與PHP運(yùn)行環(huán)境 3、有一定編程基礎(chǔ)
老師告訴你能學(xué)到什么?
1、加深對(duì)GD庫(kù)的了解 2、利用GD庫(kù)給圖片添加文字和圖片水印 3、利用GD庫(kù)壓縮圖片 5、如何打造一個(gè)屬于自己的工具類

微信掃碼,參與3人拼團(tuán)

微信客服

購(gòu)課補(bǔ)貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動(dòng)學(xué)習(xí)伙伴

公眾號(hào)

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號(hào)

友情提示:

您好,此課程屬于遷移課程,您已購(gòu)買該課程,無需重復(fù)購(gòu)買,感謝您對(duì)慕課網(wǎng)的支持!