Support » Plugin: Fly Dynamic Image Resizer » JPG compression quality feature?

  • Resolved andiszek

    (@andiszek)


    Hello, this is a very useful plugin! Thank you for developing it!

    I`ve noticed that the generated image files are quite large (90KB for a 400x400px image); the image quality/JPG compression rate is probably set to 100%, which is fine for me as i like crisp images.

    Unfortunately, clients check the pages with google page speed, and there are low scores for images that are not optimized adequately (sometimes 2%, a few KB per image). Of course, the client sees a low score and thinks that the site is extremely slow (although it loads very well on his computers….) – but hey, if google gives you a 7/10, it must be really slow!

    Is it possible to add a image quality/JPG compression feature to the Fly Resizer? for example, i want to resize the images to 400x400px with 85% JPG quality. If the images are still to large, i can reduce to 80%, etc.

    Thank you in advance & best regards!
    andi

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Junaid Bhura

    (@junaidbhura)

    Hi there,

    Glad you like the plugin! 🙂

    Image compression is on the roadmap for this plugin. The challenge is to find a good way to use compression, since these images are generated dynamically, compression might take up additional server resources while building the page – and slow down the page, or maybe even cause a timeout on slow servers.

    For now, you can use this action if you want to compress the newly created images:

    /**
     * Fly Image Created Hook
     *
     * @param  integer $attachment_id
     * @param  string $path
     * @return void
     */
    function new_fly_image_created( $attachment_id, $path ) {
        // code to compress image: compress_me( $path );
    }
    add_action( 'fly_image_created', 'new_fly_image_created', 10, 2 );
    • This reply was modified 4 years, 3 months ago by Junaid Bhura.
    Thread Starter andiszek

    (@andiszek)

    Hello,
    thank you for your reply and the function – i will test it!

    best regards,
    andi

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘JPG compression quality feature?’ is closed to new replies.