Small optimization of your code
-
I have a site with many thousands of small images however your plugin is slowing the site down.
Changing your script to load thesite_url
into a variable halved the processing time of your plugin (added first line, used variable instead of function)$site_url = get_site_url(); foreach ($html->find('img') as $img) { foreach ($rules as $rule) { if (strpos(str_replace($site_url, '', $img->src), $rule) === 0) { $img->class .= ' webpexpress-processed'; } } }
- You must be logged in to reply to this topic.