亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

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

求助,瀏覽器中無法顯示圖片,而且未生成圖片

求助,瀏覽器中無法顯示圖片,而且未生成圖片

gudufeng 2016-10-14 15:19:48
文件1 <?php ????class?image{ ????????//?圖片信息變量 ????????private?$image; ????????//?內存中的圖片 ????????private?$info; ???????? ????????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); ????????} ????????//change ????????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; ????????} ????????//display ????????public?function?show() ????????{ ????????ob_clean(); ????????header("Content-type:".$this->$info['mime']); ????????$funs="image{$this->info['type']}"; ????????$funs($this->image); ????????} ????????//save ????????public?function?save($newname) ????????{ ????????????$funs="image{$this->info['type']}"; ????????????$funs($this->image,$newname.'.'.$this->info['type']); ????????} ???????? ????????public?function?_destruct() ????????{ ????????????imagedestroy($this->image); ????????} ????} ?> 文件二 <?php ????require?"image.class.php"; ????$src='001.jpg'; ????$image=new?Image($src); ????$image->thumb(300,150); ????$image->show(); ???? ?>
查看完整描述

1 回答

已采納
?
一瞬兒光

TA貢獻178條經驗 獲得超70個贊

三個錯誤。

1,構造函數__construct兩個下劃線;

2,$this->$this->info['mime']; $this后面怎么能跟$呢?

3,save方法都沒有調用怎么執行?

查看完整回答
1 反對 回復 2016-10-14
  • 1 回答
  • 0 關注
  • 1709 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號