Mercurial > hg > cmmr2012-drupal-site
comparison core/modules/image/src/ImageEffectInterface.php @ 0:c75dbcec494b
Initial commit from drush-created site
author | Chris Cannam |
---|---|
date | Thu, 05 Jul 2018 14:24:15 +0000 |
parents | |
children | 12f9dff5fda9 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:c75dbcec494b |
---|---|
1 <?php | |
2 | |
3 namespace Drupal\image; | |
4 | |
5 use Drupal\Component\Plugin\ConfigurablePluginInterface; | |
6 use Drupal\Component\Plugin\PluginInspectionInterface; | |
7 use Drupal\Core\Image\ImageInterface; | |
8 | |
9 /** | |
10 * Defines the interface for image effects. | |
11 * | |
12 * @see \Drupal\image\Annotation\ImageEffect | |
13 * @see \Drupal\image\ImageEffectBase | |
14 * @see \Drupal\image\ConfigurableImageEffectInterface | |
15 * @see \Drupal\image\ConfigurableImageEffectBase | |
16 * @see \Drupal\image\ImageEffectManager | |
17 * @see plugin_api | |
18 */ | |
19 interface ImageEffectInterface extends PluginInspectionInterface, ConfigurablePluginInterface { | |
20 | |
21 /** | |
22 * Applies an image effect to the image object. | |
23 * | |
24 * @param \Drupal\Core\Image\ImageInterface $image | |
25 * An image file object. | |
26 * | |
27 * @return bool | |
28 * TRUE on success. FALSE if unable to perform the image effect on the image. | |
29 */ | |
30 public function applyEffect(ImageInterface $image); | |
31 | |
32 /** | |
33 * Determines the dimensions of the styled image. | |
34 * | |
35 * @param array &$dimensions | |
36 * Dimensions to be modified - an array with the following keys: | |
37 * - width: the width in pixels, or NULL if unknown | |
38 * - height: the height in pixels, or NULL if unknown | |
39 * When either of the dimensions are NULL, the corresponding HTML attribute | |
40 * will be omitted when an image style using this image effect is used. | |
41 * @param string $uri | |
42 * Original image file URI. It is passed in to allow an effect to | |
43 * optionally use this information to retrieve additional image metadata | |
44 * to determine dimensions of the styled image. | |
45 * ImageEffectInterface::transformDimensions key objective is to calculate | |
46 * styled image dimensions without performing actual image operations, so | |
47 * be aware that performing IO on the URI may lead to decrease in | |
48 * performance. | |
49 */ | |
50 public function transformDimensions(array &$dimensions, $uri); | |
51 | |
52 /** | |
53 * Returns the extension of the derivative after applying this image effect. | |
54 * | |
55 * @param string $extension | |
56 * The file extension the derivative has before applying. | |
57 * | |
58 * @return string | |
59 * The file extension after applying. | |
60 */ | |
61 public function getDerivativeExtension($extension); | |
62 | |
63 /** | |
64 * Returns a render array summarizing the configuration of the image effect. | |
65 * | |
66 * @return array | |
67 * A render array. | |
68 */ | |
69 public function getSummary(); | |
70 | |
71 /** | |
72 * Returns the image effect label. | |
73 * | |
74 * @return string | |
75 * The image effect label. | |
76 */ | |
77 public function label(); | |
78 | |
79 /** | |
80 * Returns the unique ID representing the image effect. | |
81 * | |
82 * @return string | |
83 * The image effect ID. | |
84 */ | |
85 public function getUuid(); | |
86 | |
87 /** | |
88 * Returns the weight of the image effect. | |
89 * | |
90 * @return int|string | |
91 * Either the integer weight of the image effect, or an empty string. | |
92 */ | |
93 public function getWeight(); | |
94 | |
95 /** | |
96 * Sets the weight for this image effect. | |
97 * | |
98 * @param int $weight | |
99 * The weight for this image effect. | |
100 * | |
101 * @return $this | |
102 */ | |
103 public function setWeight($weight); | |
104 | |
105 } |