Header image kills performance
Customizr v3.1.5 on WordPress 3.8
When I add a logo image to include in the header, the page takes something like 14 seconds to respond. When I remove the logo (so just the site title shows in the top-left corner), the response is immediate.
The image is 250×100 and I’ve tried PNGs and JPGs, with or without “force logo dimensions” checked … with no luck.
Has anyone else experienced this or have any insights?
I had this problem on my local windows box.
parts\class-header-header_main.php snags the img size somewhere around line 144 (depends on the version you use).
I commented out the three:
if ( @getimagesize …
lines above to correct.
Thanks for replies.
Unfortunately, this is on a non-live site at the moment. I’m trying to work with the host to move a site onto a PHP v5.3.27 environment (from PHP v5.2.17) because of some issues with “Suhosin”. The site seems to work ok on the PHP 5.2.17 box but then this 14 second thing happens on the 5.3.27 box. So basically, there’s no public link to this site for me to share.
I used the P3 plugin to get an idea of where the issue was and it put it all down to loading the theme. I confirmed that this still happens with all plugins deactivated.
Thanks for that … I’d got to roughly that area too, ready to do some trial and error over the weekend (not a PHP guru). I’m reticent to go the child theme route at the moment because some of the new features coming look quite useful to me. For the moment though, I think that is the way I’ll have to go, but I’d really like to understand what the cause is (can’t just be my problem on a shared hosting platform can it?) and get that fixed instead.
Have you checked out the ReadMe to see what has been changed in the latest version of the theme?
Yes, I gave that a glance before upgrading. Thanks.
I’ve commented out the lines muggz suggested in a child theme and it works fine now. Thinking about my situation here and the one muggz talked about, it could be something to do with getimagesize for a remote url (I’m using an amended hosts file to access the target site – if the url to the logo is absolute then it’s headed off to the live site for the image). But I’m guessing here.
I’ll restore the live backup to the 5.3.27 account, apply the child template and then get the host to switch to it over. Then I can try switching back to the native Customizr theme to see how it goes.
I’ll post back either way … hopefully with some success.
I plan on looking into why the slowdown takes place on my local PHP Version 5.3.26 only, (I was going to look @ memory allocation since it started happening only on the large full-screen logo) but have higher priorities right now.
Glad to hear it fixed the slowdown for you as well.
OK, the site has been switched to the new server and the base Customizr theme now works perfectly … no noticeable delay compared to the child theme (with the getimagesize lines commented out).
For the record, the story went something like this …
– live domain pointed to one server
– copy of the site was created on a second server (to become live server)
– hosts file on my PC was used to redirect the domain to the new server for testing
– getimagesize calls resulted in a 14 second delay in loading EVERY web page while in this configuration
– when the domain was switched to the new server, the getimagesize calls produced no delay at all.
The only conclusions I can draw are that getimagesize doesn’t like non-local references (maybe someone with a better PHP background can confirm) or that the local environment got itself a little confused about how to resolve the url (the hosting package was bound to the domain name so it may have made certain assumptions when resolving domain names and the hosts file obviously wouldn’t have come into play).
I hope this can help someone else that encounters the same problem 🙂
Thanks for the analysis Chris. That’s so helpful to others.
getimagesize() can work for local or remote files :
For remote files, some performance issues can be seen, but there are optimizations possible as reported here.
I will think about a fix for that.
Thanks for reporting and enjoy the theme!
My situation was obviously not typical, I suspect it had more to do with idiosyncrasies of the hosting environment resolving the url as this wasn’t a large file by any means (250×100 PNG).
Having said that, obviously any tweaks on performance for large files will be welcomed by some 🙂
Excellent theme, thank you for making it available!
- The topic ‘Header image kills performance’ is closed to new replies.