Closed woutk88 closed 2 years ago
@woutk88 Your changes is not working because of module's update, Can you give solution for latest module?
Sorry for this long delay. I decided to use DOMDocument to search the HTML for img
tags (by suggestion of others). This outdates your PR but it also should fix the issue. Because of that, I'm closing this PR. Let me know if things are still not working for you though.
I ran into an issue where not all images are being replaced when there are consecutive image tags. The first image would be replaced, but the second one would not. This happens because the first part of the second image tag (
<img
) is part of the first regex match.I've changed the regex to also find overlapping matches using a 'positive lookahead'. Because lookaheads do not store/consume the match, another (with the original regex)
preg_match
has been added to actually find the matching parts.This should solve https://github.com/yireo/Yireo_NextGenImages/issues/16 (and I suspect also https://github.com/yireo/Yireo_Webp2/issues/107), however as mentioned in https://github.com/yireo/Yireo_NextGenImages/issues/16#issuecomment-966884156 using a DOM parser might be more reliable.