PluginProbe
Extendify / trunk
Extendify vtrunk
3.2.1 3.2.0 3.1.6 3.1.5 3.1.4 3.1.3 3.1.2 3.1.1 3.1.0 3.0.6 3.0.5 3.0.4 trunk 0.1.0 0.10.0 0.10.1 0.10.2 0.11.0 0.11.1 0.2.0 0.3.0 0.3.1 0.4.0 0.5.0 0.6.0 All 127 releases
← All changes | app/Draft/Controllers/ImageController.php +12 -4 3.1.5 → trunk View file →
@@ -23,8 +23,16 @@
23 23
24 24 class ImageController
25 25 {
26 26 /**
27 + * Must match `PILL_RIGHT_EDGE` in `src/Shared/lib/ai-label.js`.
28 + *
29 + * @var float
30 + */
31 + // phpcs:ignore PSR12.Properties.ConstantVisibility.NotFound -- 7.0 floor: no const visibility
32 + const PILL_RIGHT_EDGE = 0.85;
33 +
34 + /**
27 35 * Upload the provided image
28 36 *
29 37 * @param \WP_REST_Request $request - The request.
30 38 * @return \WP_REST_Response
@@ -84,10 +92,10 @@
84 92 );
85 93 }
86 94
87 95 /**
88 - * Composite the client-rendered disclosure label onto the attachment,
89 - * bottom-right at a 16px inset, matching the canvas-path stamp.
96 + * Composite the client-rendered disclosure label onto the attachment. The
97 + * PNG already includes its border, unlike the canvas path's fill box.
90 98 *
91 99 * @param int $imageId - The attachment ID.
92 100 * @param string $labelPath - Path to the uploaded label PNG.
93 101 * @return void
@@ -122,10 +130,10 @@
122 130 imagealphablending($image, true);
123 131 imagecopyresampled(
124 132 $image,
125 133 $label,
126 - ($width - $labelWidth - 16),
127 - ($height - $labelHeight - 16),
134 + (int) round(($width * self::PILL_RIGHT_EDGE) - $labelWidth),
135 + (int) round(($height - $labelHeight) / 2),
128 136 0,
129 137 0,
130 138 $labelWidth,
131 139 $labelHeight,