最近中文字幕高清中文字幕无,亚洲欧美高清一区二区三区,一本色道无码道dvd在线观看 ,一个人看的www免费高清中文字幕

為了賬號安全,請及時綁定郵箱和手機(jī)立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

圖片加水印時出現(xiàn)警告?。。∵\行不下去了,求大神解答

圖片加水印時出現(xiàn)警告!??!運行不下去了,求大神解答

木上草 2017-02-21 22:36:28
<?php class?Image { ????private?$image; ????private?$imageinfo; ????public?function?__construct($src){ ????????$imageinfo=getimagesize($src); ????????$this->imageinfo=array( ????????????'width'=>$imageinfo['0'], ????????????'height'=>$imageinfo['1'], ????????????'type'=>image_type_to_extension($imageinfo['2'],false), ????????????'mime'=>$imageinfo['mime'] ????????); ????????$this->image=self::creatImage($src); ????} ????private?function?creatImage($src){ ????????$creat="imagecreatefrom{$this->imageinfo['type']}"; ????????return?$creat($src); ????} ????private?function?printImage($file=null){ ????????$primg="image{$this->imageinfo['type']}"; ????????$primg($this->image,$file);/**此處是出錯誤的那一行**/ ????} ????public?function?thumbImage($width,$height){ ????????$image_thumb=imagecreatetruecolor($width,$height); ????????imagecopyresampled($image_thumb,$this->image,0,0,0,0,$width,$height,$this->imageinfo['width'],$this->imageinfo['height']); ????????imagedestroy($this->image); ????????$this->image=$image_thumb; ????} ????public?function?fontMark($content,$font_url,$font_size,$color,$local,$angle){ ????????$colortrue=imagecolorallocatealpha($this->image,$color[0],$color[1],$color[2],$color[3]); ????????imagettftext($this->image,$font_size,$angle,$local['x'],$local['y'],$colortrue,$font_url,$content); ????} ????public?function?imageMark($smimgsrc,$local,$alpha){ ????????$info2=getimagesize($smimgsrc); ????????$type2=image_type_to_extension($info2[2],false); ????????$creatsmimg="imagecreatefrom{$type2}"; ????????$water=$creatsmimg($smimgsrc); ????????imagecopymerge($this->image,$water,$local['x'],$local['y'],0,0,$info2[0],$info2[1],$alpha); ????????imagedestroy($water); ????} ????/*瀏覽器中顯示圖片*/ ????public?function?showImage(){ ????????header("Content-type:",$this->imageinfo['mime']); ????????self::printImage($this->image); ????} ????/*保存實體文件*/ ????public?function?saveImage($picName){ ????????$picturename=$picName.'.'.$this->imageinfo['type']; ????????self::printImage($this->image,$picturename); ????} ????/*銷毀圖片*/ ????public?function?__destruct(){ ????????imagedestroy($this->image); ????} } <?php require_once?("image.php"); $src='001.jpg'; $image=new?Image($src); $local=array( ????'x'=>'20', ????'y'=>'100' ); $smimgsrc="timg.jpg"; $alpha=30; $image->imageMark($smimgsrc,$local,$alpha); $image->showImage(); var_dump($image); Warning:?imagejpeg():?supplied?resource?is?not?a?valid?stream?resource?in?D:\wamp\www\tmlog.com\image\image.php?on?line?39
查看完整描述

1 回答

已采納
?
習(xí)慣受傷

TA貢獻(xiàn)885條經(jīng)驗 獲得超1144個贊

圖片 001.jpg?不存在?你沒給具體路徑,是不是出錯了?

查看完整回答
2 反對 回復(fù) 2017-02-21
  • 木上草
    木上草
    就是當(dāng)前路徑下的隨便找張圖片。昨晚調(diào)試了3小時,最后發(fā)現(xiàn)的錯誤時,在調(diào)用printImage方法時候saveImage和showImage方法里面?zhèn)鲄?shù)傳成了當(dāng)前圖片資源對象,我定義的printImage傳的參數(shù)是路徑參數(shù),所以提示我打印的資源不是有效。
  • 習(xí)慣受傷
    習(xí)慣受傷
    OK,解決就好哈
  • 1 回答
  • 0 關(guān)注
  • 1631 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

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

幫助反饋 APP下載

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

公眾號

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