Call to undefined function imagecreatefrom() 出現(xiàn)這樣的報錯
<?php class?image{ ? ????private?$info; private?$image; ????//打開圖片 ????public?function?__construct($src){ ????//圖片信息? ????$info=getimagesize($src); ????$this->info=array( ???'width'=>$info[0], ???'height'=>$info[1], ???'type'=>image_type_to_extension($this->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']); ?$func="image{$this->info['type']}"; ?$func($this->image); ?} ?//保存到硬盤中 ??public?function?save($newname){ ?????$func="image{$this->info['type']}"; ?$func($this->image,$newname.'.'.$this->info['type']); ??} ??//銷毀圖片 ??public?function?__destruct(){ ???imagedestroy($this->image); ??} ??} ?>
Fatal error: Call to undefined function imagecreatefrom() in?D:\phpStudy\WWW\web\image.class.php?on line?17
2015-03-03
'type'=>image_type_to_extension($this->info[2],false),
'type'=>image_type_to_extension($info[2],false),