16577bfc3SGreg Roach<?php 26577bfc3SGreg Roach 36577bfc3SGreg Roach/** 46577bfc3SGreg Roach * webtrees: online genealogy 5d11be702SGreg Roach * Copyright (C) 2023 webtrees development team 66577bfc3SGreg Roach * This program is free software: you can redistribute it and/or modify 76577bfc3SGreg Roach * it under the terms of the GNU General Public License as published by 86577bfc3SGreg Roach * the Free Software Foundation, either version 3 of the License, or 96577bfc3SGreg Roach * (at your option) any later version. 106577bfc3SGreg Roach * This program is distributed in the hope that it will be useful, 116577bfc3SGreg Roach * but WITHOUT ANY WARRANTY; without even the implied warranty of 126577bfc3SGreg Roach * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 136577bfc3SGreg Roach * GNU General Public License for more details. 146577bfc3SGreg Roach * You should have received a copy of the GNU General Public License 1589f7189bSGreg Roach * along with this program. If not, see <https://www.gnu.org/licenses/>. 166577bfc3SGreg Roach */ 176577bfc3SGreg Roach 186577bfc3SGreg Roachdeclare(strict_types=1); 196577bfc3SGreg Roach 206577bfc3SGreg Roachnamespace Fisharebest\Webtrees\Contracts; 216577bfc3SGreg Roach 226577bfc3SGreg Roachuse Fisharebest\Webtrees\MediaFile; 23*06c3e14eSGreg Roachuse Intervention\Image\Interfaces\ImageInterface; 24f7cf8a15SGreg Roachuse League\Flysystem\FilesystemOperator; 256577bfc3SGreg Roachuse Psr\Http\Message\ResponseInterface; 266577bfc3SGreg Roach 276577bfc3SGreg Roach/** 286577bfc3SGreg Roach * Make an image (from another image). 296577bfc3SGreg Roach */ 306577bfc3SGreg Roachinterface ImageFactoryInterface 316577bfc3SGreg Roach{ 326577bfc3SGreg Roach /** 336577bfc3SGreg Roach * Send the original file - either inline or as a download. 346577bfc3SGreg Roach */ 35f7cf8a15SGreg Roach public function fileResponse(FilesystemOperator $filesystem, string $path, bool $download): ResponseInterface; 366577bfc3SGreg Roach 376577bfc3SGreg Roach /** 386577bfc3SGreg Roach * Send the original file - either inline or as a download. 396577bfc3SGreg Roach */ 406577bfc3SGreg Roach public function thumbnailResponse( 41f7cf8a15SGreg Roach FilesystemOperator $filesystem, 426577bfc3SGreg Roach string $path, 436577bfc3SGreg Roach int $width, 446577bfc3SGreg Roach int $height, 456577bfc3SGreg Roach string $fit 466577bfc3SGreg Roach ): ResponseInterface; 476577bfc3SGreg Roach 486577bfc3SGreg Roach /** 496577bfc3SGreg Roach * Create a full-size version of an image. 506577bfc3SGreg Roach */ 516577bfc3SGreg Roach public function mediaFileResponse(MediaFile $media_file, bool $add_watermark, bool $download): ResponseInterface; 526577bfc3SGreg Roach 536577bfc3SGreg Roach /** 546577bfc3SGreg Roach * Create a smaller version of an image. 556577bfc3SGreg Roach */ 566577bfc3SGreg Roach public function mediaFileThumbnailResponse( 576577bfc3SGreg Roach MediaFile $media_file, 586577bfc3SGreg Roach int $width, 596577bfc3SGreg Roach int $height, 606577bfc3SGreg Roach string $fit, 616577bfc3SGreg Roach bool $add_watermark 626577bfc3SGreg Roach ): ResponseInterface; 636577bfc3SGreg Roach 646577bfc3SGreg Roach /** 656577bfc3SGreg Roach * Does a full-sized image need a watermark? 666577bfc3SGreg Roach */ 676577bfc3SGreg Roach public function fileNeedsWatermark(MediaFile $media_file, UserInterface $user): bool; 686577bfc3SGreg Roach 696577bfc3SGreg Roach /** 706577bfc3SGreg Roach * Does a thumbnail image need a watermark? 716577bfc3SGreg Roach */ 726577bfc3SGreg Roach public function thumbnailNeedsWatermark(MediaFile $media_file, UserInterface $user): bool; 736577bfc3SGreg Roach 746577bfc3SGreg Roach /** 756577bfc3SGreg Roach * Create a watermark image, perhaps specific to a media-file. 766577bfc3SGreg Roach */ 77*06c3e14eSGreg Roach public function createWatermark(int $width, int $height, MediaFile $media_file): ImageInterface; 786577bfc3SGreg Roach 796577bfc3SGreg Roach /** 806577bfc3SGreg Roach * Add a watermark to an image. 816577bfc3SGreg Roach */ 82*06c3e14eSGreg Roach public function addWatermark(ImageInterface $image, ImageInterface $watermark): ImageInterface; 836577bfc3SGreg Roach 846577bfc3SGreg Roach /** 856577bfc3SGreg Roach * Send a replacement image, to replace one that could not be found or created. 866577bfc3SGreg Roach */ 876577bfc3SGreg Roach public function replacementImageResponse(string $text): ResponseInterface; 886577bfc3SGreg Roach} 89