forked from ResponsiveImagesCG/wp-tevko-responsive-images
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Use content filtering instead of the image editor to add sizes and sr…
…cset attributes Fixes ResponsiveImagesCGgh-83 Fixes ResponsiveImagesCGgh-72
- Loading branch information
1 parent
b7f9e6d
commit 2740404
Showing
2 changed files
with
75 additions
and
128 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2740404
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is looking really good. A few things that might improve performance is if we could grab the
wp-image-{id}
andsize-{size}
classnames in a single preg_match() instead of doing three (one for the class attribute and separate ones for each classname). I also think we could bail early if asrcset
attribute is already present..If we're looking for other ways to bail early, we might be able to check to see if the file path doesn't match
wp_uploads()
.I also think we want to lower the priority value in the
add_filter()
function so the code executes before someone has potentially stripped off the classnames we're looking for. I'm not sure if we should go all the way to zero (lower numbers execute first) or if we should leave room for someone to override by choosing something like 5.