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

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

正確代碼的寫法

<?php

class Image{

/*打開圖片*/

private $info;

private $image;

private $imagemark;

private $type;

public function __construct($src){

//配置圖片路徑

$imagesrc=$src;

//獲取圖片信息

$this->info=getimagesize($imagesrc);

$this->info=array(

"width"=>$this->info[0],

"height"=>$this->info[1],

"type"=>image_type_to_extension($this->info[2],FALSE),

"mime"=>$this->info["mime"],

);

//根據(jù)圖片的編號獲得圖片的類型

$this->type=$this->info["type"];

//在內(nèi)存中創(chuàng)建一個(gè)和我們圖片類型一樣的對象

$func="imagecreatefrom{$this->type}";

$this->image=$func($imagesrc);

}

/*操作圖片*/

/*給圖片添加文字水印*/

public function fontmark(){

//設(shè)置字體路徑

$font="msyh.ttf";

//設(shè)置文字內(nèi)容

$content="hello world";

//設(shè)置文字水印透明度

$color=imagecolorallocatealpha($this->image,255,0,0,50);

//添加水印

imagettftext($this->image,20,0,20,200,$color,$font,$content);

}

/*給圖片添加圖片水印*/

public function imagemark(){

//配置圖片路徑

$imagemark='logo.jpg';

//獲取圖片信息

$this->info=getimagesize($imagemark);

$this->info=array(

"width"=>$this->info[0],

"height"=>$this->info[1],

"type"=>image_type_to_extension($this->info[2],FALSE),

"mime"=>$this->info["mime"],

);

//根據(jù)圖片的編號獲得圖片的類型

$this->type=$this->info["type"];

//在內(nèi)存中創(chuàng)建一個(gè)和我們圖片類型一樣的對象

$func="imagecreatefrom{$this->type}";

$this->imagemark=$func($imagemark);

imagecopymerge($this->image,$this->imagemark,0,0,100,90,200,40,100);

}

/*將圖片按照一定大小進(jìn)行縮略*/

public function thumb(){

//創(chuàng)建一個(gè)大小固定的真空彩色圖像

$imagethumb=imagecreatetruecolor(100,100);

//將原圖縮略成我們所指定的圖像大小

imagecopyresampled($imagethumb,$this->image,0,0,0,0,100,100,$this->info["width"],$this->info["height"]);

$this->image=$imagethumb;

}

/*輸出圖片*/

public function outputimage(){

//print_r($this->type);die();

header("content-type:".$this->info["mime"]);

$func="image{$this->type}";

$func($this->image);

}

/*銷毀圖片*/

function destroy(){

imagedestroy($this->image);

}

}


正在回答

1 回答

嗯,有什么問題嗎?

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

舉報(bào)

0/150
提交
取消

正確代碼的寫法

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

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

幫助反饋 APP下載

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

公眾號

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