mirror of https://github.com/helloxz/imgurl.git
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
37 lines
684 B
37 lines
684 B
7 years ago
|
<?php
|
||
|
|
||
|
namespace Tinify;
|
||
|
|
||
|
class Result extends ResultMeta {
|
||
|
protected $data;
|
||
|
|
||
|
public function __construct($meta, $data) {
|
||
|
$this->meta = $meta;
|
||
|
$this->data = $data;
|
||
|
}
|
||
|
|
||
|
public function data() {
|
||
|
return $this->data;
|
||
|
}
|
||
|
|
||
|
public function toBuffer() {
|
||
|
return $this->data;
|
||
|
}
|
||
|
|
||
|
public function toFile($path) {
|
||
|
return file_put_contents($path, $this->toBuffer());
|
||
|
}
|
||
|
|
||
|
public function size() {
|
||
|
return intval($this->meta["content-length"]);
|
||
|
}
|
||
|
|
||
|
public function mediaType() {
|
||
|
return $this->meta["content-type"];
|
||
|
}
|
||
|
|
||
|
public function contentType() {
|
||
|
return $this->mediaType();
|
||
|
}
|
||
|
}
|