• Resolved Hrohh

    (@hrohh)


    Please add
    acf-image-aspect-ratio-crop.php

    #69

    if ( $data['aspectRatioWidth'] == $data['width'] && $data['aspectRatioHeight'] == $data['height'] ) {
        wp_send_json(['id' => $data['id']]);
        wp_die();
    }
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author joppuyo

    (@joppuyo)

    Hey, thanks for your suggestion, I will look into this.

    If I understand correctly, this code will skip the cropping process if the image already matches the specified aspect ratio, am I correct?

    Thread Starter Hrohh

    (@hrohh)

    Yes exactly! :))

    Thread Starter Hrohh

    (@hrohh)

    It should be ( == vs === ). Sorry ??

    
    if ( $data['aspectRatioWidth'] === $data['width'] && $data['aspectRatioHeight'] === $data['height'] ) {
        wp_send_json(['id' => $data['id']]);
        wp_die();
    }
    
    Plugin Author joppuyo

    (@joppuyo)

    Hey, apologies this took a while but this fix is now part of version 1.0.5, just release on w.org. I added some additional checks that if the resulting image size differs less than 0.5% from the original, the resizing is skipped.

    Huge thanks for this idea, it helps with the performance a lot!

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘tip for optimization’ is closed to new replies.