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

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定

正在回答

2 回答

<?php
class Image {
??? /*圖片的基本信息*/
??? private $info;
??? /*構(gòu)造函數(shù),打開圖片,讀取到內(nèi)存中*/
??? 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){
??????? //1.在內(nèi)存中建立一個真色彩圖片
??????? $image_thumb = imagecreatetruecolor($width,$height);
??????? //2.核心步驟,將原圖復(fù)制到新建的真色彩圖片上,并且按照一定比例壓縮
??????? imagecopyresampled($image_thumb,$this->image,0,0,0,0,$width,$height,$this->info['width'],$this->info['height']);
??????? //3.銷毀原始圖片
??????? imagedestroy($this->image);
??????? $this->image = $image_thumb;
??? }

??? /*操作圖片(添加文字水印)*/
??? public function fontmark($content,$font_url,$size,$color,$local,$angle){
??????? //設(shè)置字體的顏色和透明度,參數(shù)1 內(nèi)存中的圖片 2 red 3 gleen 4 bule 5 透明度
??????? $col = imagecolorallocatealpha($this->image,$color[0],$color[1],$color[2],$color[3]);
??????? //寫入文件
??????? imagettftext($this->image,$size,$angle,$local['x'],$local['y'],$col,$font_url,$content);
??? }

??? /*操作圖片(添加圖片水印)*/
??? public function imageMark($source,$local,$alpha){
??????? $info2 = getimagesize($source);
??????? $type2 = image_type_to_extension($info2[2],false);
??????? $fun2 = "imagecreatefrom{$type2}";
??????? $water = $fun2($source);
??????? imagecopymerge($this->image,$water,$local['x'],$local['y'],0,0,$info2[0],$info2[1],$alpha);
??????? imagedestroy($water);
??? }

??? /*在瀏覽器中輸出圖片*/
??? public function show(){
??????? header("Content-type:".$this->info["mime"]);
??????? $funs = "image{$this->info['type']}";
??????? $funs($this->image);
??? }

??? /*把圖片保存到硬盤里*/
??? public function save($newname){
??????? $funs = "image{$this->info['type']}";
??????? $funs($this->image, $newname . "." . $this->info["type"]);
??? }

??? /*用析構(gòu)函數(shù)銷毀圖片*/
??? public function __destruct(){
??????? imagedestroy($this->image);
??? }
}

0 回復(fù) 有任何疑惑可以回復(fù)我~
#1

qq_Runningman_14242494 提問者

非常感謝!
2016-10-29 回復(fù) 有任何疑惑可以回復(fù)我~

不是,可以參考php手冊

0 回復(fù) 有任何疑惑可以回復(fù)我~

舉報

0/150
提交
取消

添加水印圖片

我要回答 關(guān)注問題
微信客服

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

幫助反饋 APP下載

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

公眾號

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