求助,浏览器中无法显示图片,而且未生成图片

文件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();
    
?>


gudufeng
浏览 1643回答 1
1回答

一瞬儿光

三个错误。1,构造函数__construct两个下划线;2,$this->$this->info['mime']; $this后面怎么能跟$呢?3,save方法都没有调用怎么执行?
打开App,查看更多内容
随时随地看视频慕课网APP