打印图片封装类出现警告怎么办?
<?php
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2017/2/21
* Time: 17:20
*/
class Image
{
/*内存中的图片*/
private $image;
/*私有的图片资源信息,不给外部使用*/
private $imageinfo;
/*创建类时打开图片读取到内存中*/
/**
* Image constructor.
* @param $src
*/
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);
}
/*图片压缩*/
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;
}
/*快捷打印方式*/
private function printImage($type,$file=null){
$primg="image{$this->imageinfo['type']}";
$primg($this->image,$file);
}
/*浏览器中显示图片*/
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
/**
* Created by PhpStorm.
* User: Administrator
* Date: 2017/2/21
* Time: 19:18
*/
require_once ("image.php");
$src='001.jpg';
$image=new Image($src);
$image->thumbImage(300,150);
//$image->showImage();
$image->saveImage(xiaoqiche);
Notice: Use of undefined constant xiaoqiche - assumed 'xiaoqiche' in D:\wamp\www\tmlog.com\image\test.php on line 13
求大神解惑~~~~~~