1 | <?php |
||
9 | class CoverCache |
||
10 | { |
||
11 | protected $filesystem; |
||
12 | protected $imageManager; |
||
13 | protected $fsConfig; |
||
14 | |||
15 | public function __construct(AdapterInterface $filesystem, ImageManager $imageManager, FlysystemConfig $fsConfig) |
||
21 | |||
22 | /** |
||
23 | * @param string $key |
||
24 | * |
||
25 | * @return string |
||
26 | */ |
||
27 | public function url($key) |
||
35 | |||
36 | /** |
||
37 | * @param string $url |
||
38 | * @param int $maxHeight |
||
39 | * |
||
40 | * @throws \ErrorException |
||
41 | * |
||
42 | * @return CachedImage |
||
43 | */ |
||
44 | public function putUrl($url, $maxHeight = 0) |
||
48 | |||
49 | /** |
||
50 | * @param string $blob |
||
51 | * @param int $maxHeight |
||
52 | * |
||
53 | * @throws \ErrorException |
||
54 | * |
||
55 | * @return CachedImage |
||
56 | */ |
||
57 | public function putBlob($blob, $maxHeight = 0) |
||
61 | |||
62 | /** |
||
63 | * Retrieves the content of an URL. |
||
64 | * |
||
65 | * @return string |
||
66 | */ |
||
67 | protected function download($sourceUrl) |
||
73 | |||
74 | /** |
||
75 | * Store a file in cache. |
||
76 | * |
||
77 | * @param string $sourceUrl |
||
78 | * @param string $data |
||
79 | * @param int $maxHeight |
||
80 | * @return CachedImage |
||
81 | * @throws \ErrorException |
||
82 | */ |
||
83 | protected function store($sourceUrl = null, $data = null, $maxHeight = 0) |
||
115 | |||
116 | public function getMetadata($cacheKey) { |
||
128 | |||
129 | /** |
||
130 | * Return a representation with height no more than $maxHeight. |
||
131 | * |
||
132 | * @param string $maxHeight |
||
133 | * |
||
134 | * @throws \ErrorException |
||
135 | * |
||
136 | * @return CachedImage |
||
137 | */ |
||
138 | public function thumb($cacheKey, $maxHeight) |
||
146 | } |
||
147 |