PluginProbe
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization / 3.11.3
Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization v3.11.3
4.2.13 4.2.12 4.2.11 4.2.10 4.2.9 4.2.8 4.2.7 4.2.6 4.2.5 2.5.5 2.5.6 2.5.7 3.0.0 3.0.1 3.1.0 3.1.1 3.1.2 3.1.3 3.10.0 3.11.0 3.11.1 3.11.2 3.11.3 3.12.0 3.12.1 All 134 releases
optimole-wp / inc / image_properties / watermark.php

watermark.php in Optimole – Optimize Images | Convert WebP & AVIF | CDN & Lazy Load | Image Optimization 3.11.3, at inc/image_properties/watermark.php

74 lines 1.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 /**
4 * Class Optml_Watermark
5 */
6 class Optml_Watermark extends Optml_Property_Type {
7
8 /**
9 * Watermark Property.
10 *
11 * @var mixed $watermark
12 */
13 private $watermark;
14
15 /**
16 * Optml_Watermark constructor.
17 *
18 * @param array $value Watermark details.
19 */
20 public function __construct( $value = [] ) {
21 $this->set( $value );
22 }
23
24 /**
25 * Set property value.
26 *
27 * @param mixed $value Value to set.
28 */
29 public function set( $value ) {
30 $this->watermark = $value;
31 }
32
33 /**
34 * Return property value.
35 *
36 * @return mixed
37 */
38 public function get() {
39 return $this->watermark;
40 }
41
42 /**
43 * Return ImageProxy URL formatted string property.
44 *
45 * @return mixed
46 */
47 public function toString() {
48 $base = sprintf(
49 'wm:%s',
50 $this->watermark['id'] . ':' .
51 $this->watermark['opacity'] . ':' .
52 $this->watermark['position']
53 );
54
55 if ( ! empty( $this->watermark['scale'] ) ) {
56 return $base . ':' .
57 $this->watermark['x_offset'] . ':' .
58 $this->watermark['y_offset'] . ':' .
59 $this->watermark['scale'];
60 }
61 if ( ! empty( $this->watermark['y_offset'] ) ) {
62 return $base . ':' .
63 $this->watermark['x_offset'] . ':' .
64 $this->watermark['y_offset'];
65 }
66 if ( ! empty( $this->watermark['x_offset'] ) ) {
67 return $base . ':' .
68 $this->watermark['x_offset'];
69 }
70
71 return $base;
72 }
73 }
74