Attachment_Hooks
Keeps the sidecars in step with the attachments they belong to.
Namespace: WebberZone\Image_Optimizer
Since: 1.0.0
Source: includes/class-attachment-hooks.php line 21
Methods
__construct()
Constructor.
Since: 1.0.0
Line: 28
public function __construct( );
maximum_image_dimension()
Apply the configured upload dimension without replacing the default filter value.
Since: 1.2.0
Line: 51
public function maximum_image_dimension( $threshold, $imagesize = ..., $file = ..., $attachment_id = ... ): int|false;
| Type | Name | Description |
|---|---|---|
int|false |
$threshold |
Incoming threshold. |
array |
$imagesize |
Image dimensions. |
string |
$file |
Upload path. |
int |
$attachment_id |
Attachment ID. |
Returns: int|false — Upload threshold.
on_metadata_updated()
Convert or queue changed files without modifying attachment metadata.
Since: 1.0.0
Line: 75
public function on_metadata_updated( $data, $attachment_id ): array<string,;
| Type | Name | Description |
|---|---|---|
mixed |
$data |
Attachment metadata about to be stored. |
int |
$attachment_id |
Attachment ID. |
Returns: array<string, — mixed> Unmodified metadata.
on_delete_attachment()
Remove sidecars and the queue row before attachment files disappear.
Since: 1.0.0
Line: 109
public function on_delete_attachment( $attachment_id ): void;
| Type | Name | Description |
|---|---|---|
int |
$attachment_id |
Attachment ID. |
Returns: void