0

If someone uses the WP Image Editor, I want to know what edits were done.

I tried out some simple sample code like this:

add_filter( 'wp_save_image_editor_file', 'after_edit', 10, 5 );


function after_edit( $saved, $filename, $image, $mime_type, $post_id ){
  error_log(print_r($image, true));

  return $saved;
}

The output was like this:

[08-Nov-2023 21:10:38 UTC] WP_Image_Editor_Imagick Object
(
    [image:protected] => Imagick Object
        (
        )

    [file:protected] => /var/www/html/wp-content/uploads/2023/11/test.jpg
    [size:protected] => Array
        (
            [width] => 1193
            [height] => 1689
        )

    [mime_type:protected] => image/jpeg
    [output_mime_type:protected] => 
    [default_mime_type:protected] => image/jpeg
    [quality:protected] => 82
    [default_quality:protected] => 82
)

As far as I could tell, this is telling me the current state of the image. Not whether it was rotated vs scaled vs cropped. Is there no way to know that?

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.