-
Notifications
You must be signed in to change notification settings - Fork 53
Expand file tree
/
Copy pathResultMeta.php
More file actions
46 lines (39 loc) · 859 Bytes
/
ResultMeta.php
File metadata and controls
46 lines (39 loc) · 859 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
<?php
namespace Tinify;
class ResultMeta {
protected $meta;
/**
* @param array $meta
*/
public function __construct($meta) {
$this->meta = $meta;
}
/**
* @return int
*/
public function width() {
return intval($this->meta["image-width"]);
}
/**
* @return int
*/
public function height() {
return intval($this->meta["image-height"]);
}
/**
* @return string|null
*/
public function location() {
return isset($this->meta["location"]) ? $this->meta["location"] : null;
}
/**
* @return string|null
*/
public function extension() {
if (isset($this->meta["content-type"])) {
$parts = explode("/", $this->meta["content-type"]);
return end($parts);
}
return null;
}
}