• Resolved Gal Baras

    (@galbaras)


    When Image Regenerate & Select Crop is installed together with EWWW Image Optimizer, it seems to ignore thumbnail sizes disabled by EWWW (Resize tab).

    Can you please make the two plugins work together well? This may just be a matter of hook priority, but at the very least, look for these settings and copy them during activation, unless that’s already been done once (I hope this is clear).

Viewing 15 replies - 1 through 15 (of 36 total)
  • Thread Starter Gal Baras

    (@galbaras)

    Clarification from the author of EWWW Image Optimizer: We hook onto “intermediate_image_sizes” for disabling sizes.

    Plugin Author Iulia Cazan

    (@iulia-cazan)

    Hello,

    The two plugins are not using the same settings, each is handling the processing of images differently. However, if my understanding of what you are asking is correct, you would need that when you disable sizes in EWWW Image Optimizer to automatically update the Image Regenerate & Select Crop settings to ignore these too.

    Please confirm.

    Regards,
    Iulia

    Thread Starter Gal Baras

    (@galbaras)

    Yes. I guess if you use hooks, one plugin is always first, which means that the other needs to do the checking, but I’m guessing both plugins use settings, which means they can both check each other.

    The answer may come from a logical decision of which plugin operates first, i.e. does generation happen before optimisation? If that’s the case, the optimisation plugin should check the IRSC settings.

    Either way, it’ll be great if you could work with Shane on this directly (https://github.com/nosilver4u/ewww-image-optimizer/ or through the chat widget on https://ewww.io/).

    Plugin Author Iulia Cazan

    (@iulia-cazan)

    Hi Gal,

    Thanks for the details and also for suggesting to work directly with Shane on this.

    However, I checked the EWWW plugin and this is not some complicated integration. I would love to work with him, it’s just that what you are asking does not require anything to be changed by Shane in EWWW. Perhaps you could just let him know that I plan to implement the integration you suggested.

    The EWWW plugin settings are updated with the WP native function that actually allows anyone to hook and adjust options as needed. This means that I can make the integration work both ways.

    In other words, when you set the scripts to global ignore one size in IRSC this can be reflected in EWWW, and also when you disable creation for one size in EWWW this can be reflected in IRSC.

    I will include this type of integration/feature in the next release.

    Regards,
    Iulia

    Hi, I just wanted to chime in here, as I’ve been communicating with Gal via email.

    He discovered in testing that EWWW IO was not permitting IRSC to regenerate thumbnails, which is due to a block that EWWW IO places on re-generating an file that already exists. Of course, we do this to protect customers from “runaway” plugins that might eat up server resources and API credits, not to make things harder for regeneration plugins ??

    The best way to resolve this is to find out the admin_ajax hook that IRSC uses (or any other parameter) to indicate to EWWW IO that IRSC is running a regenerate and that it should “step out of the way”.

    So if you can let me know what the best way to detect a IRSC regen, I’d appreciate it!

    Plugin Author Iulia Cazan

    (@iulia-cazan)

    Hello,

    If I understand correctly what you ask, the action is sirsc_show_actions_result.
    Let me know if this is what you are looking for to bypass the block of execution.

    Also, if you think it would be helpful/faster, I can define a constant you could check to see if it’s defined, something like DOING_SIRSC.

    Let me know,
    Iulia

    That information is exactly what I was after, but it definitely would be helpful to define a constant like DOING_SIRSC! That way things don’t break if you change the AJAX action in the future.

    Plugin Author Iulia Cazan

    (@iulia-cazan)

    This is great!
    I will add a line to define this as true (boolean) and will include it in the next release + the integration to sync the settings as Gal suggested (the integration will be turned on/off by the user as needed).

    Regards,
    Iulia

    Thread Starter Gal Baras

    (@galbaras)

    Love it! Thank you both!

    One more thing we found, is that we don’t have a way to auto-optimize the thumbs generated by ISRC. I tried just hooking into the plugin’s calls to wp_update_attachment_metadata(), but it appears that gets called multiple times per attachment. I’m guessing once per thumb, as it was 6x on my site. Would it be possible to have a custom filter/action triggered after a thumbnail regen is completed?

    Plugin Author Iulia Cazan

    (@iulia-cazan)

    Sure, I am thinking to add something like do_action( 'sirsc_image_processed', $attachment_id, $image_size );. Let me know if this is something you can work with.

    • This reply was modified 5 years, 5 months ago by Iulia Cazan.

    Would that run after each individual thumb? Ideally, so EWWW IO can use async/deferred processing, we would want an action that runs after all the thumbs are completed for a particular $attachment_id. Even better would be if you passed the $metadata as the first parameter, then we can hook directly into our “optimize from meta” function.

    Plugin Author Iulia Cazan

    (@iulia-cazan)

    I think I understand. So, something like do_action( 'sirsc_attachment_images_processed', $metadata, $attachment_id );. Is this good for you?

    Yeah, that’s what we’re looking for!
    Having the ID as parameter 2 is perfect also, that’s the second parameter on our function already.

    Plugin Author Iulia Cazan

    (@iulia-cazan)

    Hello @nosilver4u

    I am pretty close to finishing the implementation for compatibility with WP 5.3 and the integration with the EWWW IO plugin. As you know, my plugin allows for the user to remove from the UI any specific file (except for the vital ones), and when that happens, the EWWW IO info is not reflecting this (I do not see this as a bug, it’s a separate data presented to the users, but from my point of view, it is a bit confusing).

    Please see an example of one attachment cleaned up after removing some image sizes (not registered any more in the application):
    SIRSC info: https://imgur.com/sMJnpod
    EWWW IO info: https://imgur.com/z1LNGet

    For this, I added a new custom action when the files are removed sirsc_images_file_deleted with two parameters $attachment_id and $file. Perhaps this is something you could use to do some other processing in your plugin like do_action( 'sirsc_image_file_deleted', $attachment_id, $file );.

    Let me know what you think about this.

    Regards,
    Iulia

Viewing 15 replies - 1 through 15 (of 36 total)
  • The topic ‘Integration with EWWW Resize settings’ is closed to new replies.