Viewing 12 replies - 1 through 12 (of 12 total)
  • Plugin Contributor Daryll Doyle

    (@enshrined)

    Hi @cjyabraham,

    Thanks for flagging this with me.

    I’m currently in the process of rewriting a large chunk of this plugin to clean it up and make it more performant. I’ll add this to the list of things to look at.

    Unfortunately at this time, there’s not an easy way to remove the function call. If you’d like to try, you’d need to unhook the following:

    
    add_filter( 'wp_get_attachment_image_attributes', array( $this, 'fix_direct_image_output' ), 10, 3 );
    
    add_action( 'get_image_tag', array( $this, 'get_image_tag_override' ), 10, 6 );
    
    Thread Starter cjyabraham

    (@cjyabraham)

    Ok, great. I’ll keep an eye out for updates to the plugin. Thanks!

    Thread Starter cjyabraham

    (@cjyabraham)

    Hi Daryll,
    Any updates on improving the speed of svg_dimensions. For our page here, because we have so many svgs, it’s often increasing load time by 4s or more.

    Thanks,
    Chris

    Plugin Contributor Daryll Doyle

    (@enshrined)

    Hi @cjyabraham,

    Apologies for the delay, COVID-19 has put a dent in the amount of time I have to look at things at the moment.

    I’ve had a brief look into the issue this morning and whilst I can easily add a new filter that will allow you to bypass these functions, they shouldn’t be (and aren’t on my install) running on the front end of the site. They should only be running when an image is first added to the editor.

    Can you confirm that it’s definitely running on the front end of the site please, as I can’t see what would be causing this? If it is, then narrowing down why it’s running on the front end would b helpful, as that shouldn’t be happening. I’m happy to look into it for you if you can provide me with a stack trace.

    If you are seeing the slow down in the editor, then I’ll be happy to add the filter for you to bypass these.

    Cheers,
    Daryll

    Thread Starter cjyabraham

    (@cjyabraham)

    Daryll,
    Thanks for taking a look at this. Here is the stack trace caused when loading a page on the front-end of the site. Does that help?

    Chris

    Plugin Contributor Daryll Doyle

    (@enshrined)

    Thanks Chris,

    That helps massively. I was testing via inserted static images, but it seems it’s called differently for you. I’ll try and get a fix out this afternoon for you ??

    Cheers,
    Daryll

    Thread Starter cjyabraham

    (@cjyabraham)

    Just to add… this trace is being triggered by a custom block I wrote that has a server-side callback to render the output for the block. So each page load runs this callback function.

    In the callback function I call get_the_post_thumbnail for each SVG logo in our sponsors section of the page. So that is why it causes this on front-end of the site. Is there a way to get the url for the image without having to trigger the costly svg_dimensions function call?

    Thread Starter cjyabraham

    (@cjyabraham)

    hi Daryll, any progress with this or anything I can test out?
    Thanks,
    Chris

    Plugin Contributor Daryll Doyle

    (@enshrined)

    Hi Chris,

    I’ve got something to test, but am having trouble getting the svg_dimensions call to fire on the front end. Do you have an email that it’s possible to send you a version of the plugin to test? If that works for you, then I’ll update the repo version and push the fix out.

    Cheers,
    Daryll

    Thread Starter cjyabraham

    (@cjyabraham)

    Daryll,
    I entered my email in a comment and then deleted the comment but you may have got an email update with it?

    Thanks,
    Chris

    Thread Starter cjyabraham

    (@cjyabraham)

    I have edited the plugin to achieve my own solution for this.

    Thread Starter cjyabraham

    (@cjyabraham)

    Is it possible to have this edit be included in subsequent versions of the plugin so I can stop using my forked version?

Viewing 12 replies - 1 through 12 (of 12 total)
  • The topic ‘slow performance of svg_dimensions function’ is closed to new replies.