Merge branch '3.1' into 5.2
[GitHub/WoltLab/WCF.git] / wcfsetup / install / files / lib / data / IImageViewerAction.class.php
1 <?php
2 namespace wcf\data;
3
4 /**
5 * Every database object action providing images for .wcfImageViewer() must implement this interface.
6 *
7 * @author Alexander Ebert
8 * @copyright 2001-2019 WoltLab GmbH
9 * @license GNU Lesser General Public License <http://opensource.org/licenses/lgpl-license.php>
10 * @package WoltLabSuite\Core\Data
11 */
12 interface IImageViewerAction {
13 /**
14 * Validates parameters to load the next images.
15 */
16 public function validateLoadNextImages();
17
18 /**
19 * Returns a list of images, array indices given for 'images' are discarded (series and series 'url' are optional).
20 * The first response (offset = 0) must return the total number of images.
21 *
22 * Each requests contains three parameters:
23 * - offset: number of already loaded image
24 * - maximumHeight: image provided in 'url' must be as close as possible to this value
25 * - maximumWidth: see above
26 * - targetImageID: preload all images which are before the target image id as well as the next X images (optional, always present but might be '0')
27 *
28 * Each image can specify a link which should not point to the image itself, instead it should provide a viewable
29 * page directly related to the image (e.g. photo page). The 'fullURL' parameter is optional and results in the
30 * link "View original image" and should lead to the original exceeding lager than the image specified with 'url'.
31 *
32 * Expected return value:
33 * array(
34 * 'images' => array(
35 * array(
36 * 'image' => array(
37 * 'height' => 768,
38 * [ 'fullURL' => 'http://example.com/path/to/full/image.png', ]
39 * [ 'link' => 'http://example.com/index.php/123-MyImage/', ]
40 * 'title' => 'My first picture',
41 * 'url' => 'http://example.com/path/to/large/image.png',
42 * 'width' => 1024
43 * ),
44 * 'thumbnail' => array(
45 * 'height' => 148,
46 * 'url' => 'http://example.com/path/to/thumbnail.png',
47 * 'width' => 148
48 * ),
49 * [ 'series' => array(
50 * 'title' => 'My image series,
51 * [ 'link' => 'http://example.com/link/to/image/series/ ]
52 * ), ]
53 * 'user' => array(
54 * 'avatarURL' => 'http://link/to/avatar.png',
55 * 'link' => 'http://example.com/index.php/123-FooBar/',
56 * 'username' => 'FooBar'
57 * )
58 * ),
59 * // ...
60 * ),
61 * [ 'items' => 123 ]
62 * )
63 *
64 * @return array
65 */
66 public function loadNextImages();
67 }