1 | <?php |
||
14 | class StreamReader |
||
15 | { |
||
16 | /** @var bool Flag whether allow_url_fopen is enabled */ |
||
17 | protected $isFopenEnabled = false; |
||
18 | |||
19 | /** @var string Data retrieved from remote */ |
||
20 | public $data = ''; |
||
21 | |||
22 | /** |
||
23 | * Constructor for fastImageSize class |
||
24 | */ |
||
25 | 72 | public function __construct() |
|
30 | |||
31 | /** |
||
32 | * Reset stream reader data |
||
33 | */ |
||
34 | 72 | public function resetData() |
|
38 | |||
39 | /** |
||
40 | * Get image from specified path/source |
||
41 | * |
||
42 | * @param string $filename Path to image |
||
43 | * @param int $offset Offset at which reading of the image should start |
||
44 | * @param int $length Maximum length that should be read |
||
45 | * @param bool $forceLength True if the length needs to be the specified |
||
46 | * length, false if not. Default: true |
||
47 | * |
||
48 | * @return false|string Image data or false if result was empty |
||
49 | */ |
||
50 | 69 | public function getImage($filename, $offset, $length, $forceLength = true) |
|
66 | |||
67 | /** |
||
68 | * Get image data for specified filename with offset and length |
||
69 | * |
||
70 | * @param string $filename Path to image |
||
71 | * @param int $offset Offset at which reading of the image should start |
||
72 | * @param int $length Maximum length that should be read |
||
73 | */ |
||
74 | 69 | protected function getImageData($filename, $offset, $length) |
|
105 | |||
106 | /** |
||
107 | * Get seekable image data in form of Guzzle stream interface |
||
108 | * |
||
109 | * @param string $filename Filename / URL to get |
||
110 | * @param int $offset Offset for response body |
||
111 | * @return \GuzzleHttp\Stream\StreamInterface|null Stream interface of |
||
112 | * requested image or null if it could not be retrieved |
||
113 | */ |
||
114 | 27 | public function getSeekableImageData($filename, $offset) |
|
129 | } |
||
130 |