Server IP : 184.154.167.98 / Your IP : 3.12.146.108 Web Server : Apache System : Linux pink.dnsnetservice.com 4.18.0-553.22.1.lve.1.el8.x86_64 #1 SMP Tue Oct 8 15:52:54 UTC 2024 x86_64 User : puertode ( 1767) PHP Version : 8.2.27 Disable Function : NONE MySQL : OFF | cURL : ON | WGET : ON | Perl : ON | Python : ON | Sudo : ON | Pkexec : ON Directory : /home/puertode/www/contratos/apps/gallery/lib/Http/ |
Upload File : |
<?php /** * Nextcloud - Gallery * * This file is licensed under the Affero General Public License version 3 or * later. See the COPYING file. * * @author Olivier Paroz <galleryapps@oparoz.com> * * @copyright Olivier Paroz 2017 */ namespace OCA\Gallery\Http; use OCP\AppFramework\Http\Response; use OCP\AppFramework\Http; /** * A renderer for images * * @package OCA\Gallery\Http */ class ImageResponse extends Response { /** * @var \OC_Image|string */ private $preview; /** * Constructor * * @param array $image image meta data * @param int $statusCode the HTTP status code, defaults to 200 */ public function __construct(array $image, $statusCode = Http::STATUS_OK) { $name = $image['name']; $this->preview = $image['preview']; $this->setStatus($statusCode); $this->addHeader('Content-type', $image['mimetype'] . '; charset=utf-8'); $this->addHeader('Content-Disposition', 'attachment; filename*=UTF-8\'\'' . rawurlencode($name) . '; filename="' . rawurlencode($name) . '"' ); } /** * Returns the rendered image * * @return string the file */ public function render() { if ($this->preview instanceof \OC_Image) { // Uses imagepng() to output the image return $this->preview->data(); } else { return $this->preview; } } }