|
@@ -52,17 +52,20 @@
|
|
|
imagedestroy($this->img);
|
|
|
}
|
|
|
public function jsonSerialize(){
|
|
|
- ob_start();
|
|
|
- $this();
|
|
|
- $data = ob_get_contents();
|
|
|
- ob_end_clean();
|
|
|
return array(
|
|
|
'width'=>$this->width,
|
|
|
'height'=>$this->height,
|
|
|
'type'=>$this->type,
|
|
|
- 'data'=>'data:image/'.$this->type.';base64,'.base64_encode($data)
|
|
|
+ 'data'=>'data:image/'.$this->type.';base64,'.base64_encode($this->toData())
|
|
|
);
|
|
|
}
|
|
|
+ public function toData(){
|
|
|
+ ob_start();
|
|
|
+ $this();
|
|
|
+ $data = ob_get_contents();
|
|
|
+ ob_end_clean();
|
|
|
+ return $data;
|
|
|
+ }
|
|
|
public function __toString(){
|
|
|
return '[Image Object ('.$this->width.','.$this->height.')]';
|
|
|
}
|