1 | <?php |
||
2 | /** |
||
3 | * Nextcloud - Gallery |
||
4 | * |
||
5 | * This file is licensed under the Affero General Public License version 3 or |
||
6 | * later. See the COPYING file. |
||
7 | * |
||
8 | * @author Olivier Paroz <[email protected]> |
||
9 | * |
||
10 | * @copyright Olivier Paroz 2017 |
||
11 | */ |
||
12 | |||
13 | namespace OCA\Gallery\Http; |
||
14 | |||
15 | use OCP\AppFramework\Http\Response; |
||
0 ignored issues
–
show
|
|||
16 | use OCP\AppFramework\Http; |
||
0 ignored issues
–
show
The type
OCP\AppFramework\Http was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
17 | |||
18 | /** |
||
19 | * A renderer for images |
||
20 | * |
||
21 | * @package OCA\Gallery\Http |
||
22 | */ |
||
23 | class ImageResponse extends Response { |
||
24 | |||
25 | /** |
||
26 | * @var \OC_Image|string |
||
0 ignored issues
–
show
The type
OC_Image was not found. Maybe you did not declare it correctly or list all dependencies?
The issue could also be caused by a filter entry in the build configuration.
If the path has been excluded in your configuration, e.g. filter:
dependency_paths: ["lib/*"]
For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths ![]() |
|||
27 | */ |
||
28 | private $preview; |
||
29 | |||
30 | /** |
||
31 | * Constructor |
||
32 | * |
||
33 | * @param array $image image meta data |
||
34 | * @param int $statusCode the HTTP status code, defaults to 200 |
||
35 | */ |
||
36 | public function __construct(array $image, $statusCode = Http::STATUS_OK) { |
||
37 | $name = $image['name']; |
||
38 | $this->preview = $image['preview']; |
||
39 | |||
40 | $this->setStatus($statusCode); |
||
41 | $this->addHeader('Content-type', $image['mimetype'] . '; charset=utf-8'); |
||
42 | $this->addHeader('Content-Disposition', |
||
43 | 'attachment; filename*=UTF-8\'\'' . rawurlencode($name) . '; filename="' |
||
44 | . rawurlencode($name) . '"' |
||
45 | ); |
||
46 | } |
||
47 | |||
48 | /** |
||
49 | * Returns the rendered image |
||
50 | * |
||
51 | * @return string the file |
||
52 | */ |
||
53 | public function render() { |
||
54 | if ($this->preview instanceof \OC_Image) { |
||
55 | // Uses imagepng() to output the image |
||
56 | return $this->preview->data(); |
||
57 | } else { |
||
58 | return $this->preview; |
||
59 | } |
||
60 | } |
||
61 | |||
62 | } |
||
63 |
The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g.
excluded_paths: ["lib/*"]
, you can move it to the dependency path list as follows:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths