找不到那錯(cuò)了?
<?php
class Image{
//內(nèi)存中的圖片
private $image;
//圖片基本信息
private $info;
/**
*打開(kāi)一張圖片,讀取到內(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){
$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);
}
/**
*保存圖片
*/
public function save(){
$funs="image{$this->info['type']}";
$funs($this->image,$newname.'.'.$this->info['type']);
}
/**
*銷(xiāo)毀圖片
*/
public function __destruct(){
imagedestroy($this->image);
}
}
?>
2016-03-16
保存圖片方法中 ?public function save($newname),你少了參數(shù)$newname。
2016-01-12
錯(cuò)誤提示是什么?