Goal: minimizing the loading time of my website
I did lots of scans and speed tests.
They all indicate, there is lots of time spent uselessly, waiting for a HTTP response. The time spent actually sending data is very small compared to that.
Screenshot of a 'speed test':
I started loading all the scripts and styles in PHP and just echoing them:
<!-- loading a style -->
<style><?php echo file_get_contents("style.css"); ?></style>
<!-- loading a script (similar) -->
<script type="text/javascript"><?php echo file_get_contents("script.js"); ?></script>
That does work, however, the images still slow things down a little. How do I use php to read them and echo them as a <img>
tag?
(The mentioned website is https://www.finnmglas.com/)
Everyone seeking answers to this:
You should not echo back images with PHP into the main file:
Echoing images from a separate PHP file and including a <img>
tag pointing at that PHP should not be a problem ^^