Reputation: 2819
I am tweaking a zen-cart website to be more cpu efficient. After profiling it, I see that the getimagesize function is accounting for nearly 50% of page load time. The images are locally stored. One option is to go through zen-cart's source code and replace this function with something custom to reference a cached value since images are rarely ever changed. However, since php is open source, perhaps another option is available: Is there any way to modify this function to make it just read a value from a cache which I can set whenever I upload an image to the server? Maybe by adding an optional parameter to the function that makes it read from cache.
Upvotes: 2
Views: 611
Reputation: 449395
Interesting idea, but this would require recompiling PHP. While not impossible, it's probably not a good idea from a maintenance point of view: You would have to re-integrate your patch on every PHP update.
However, you might be able to override getimagesize()
: There seem to be PHP modules and libraries that can add this capability to PHP.
I have no experience with any of them, but here are some suggestions on how to do it:
Upvotes: 1