Reputation: 641
This is my code for loading the image in index.php page from database.
<div id=images>
<h1><?php echo $row['title']; ?></h1> //Title coming from database table
<img src="<?php echo $row['image']; ?>"> //Image url coming from database table
<hr/>
</div>
and I have created an external css file style.css which is as follows:
#images img {
width:100%;
}
I have total of 20-25 images (each of approx 30-35 KB) in this page and the average loading time of each image is 1 second which causes the complete webpage to open in approx 25-30 seconds.
Same thing is being used in one of my competitor's website with same amount of images (each of approx above 100 KB) is having approx loading time of each image about 0.13 second.
As per my analysis the problem is with the code of images only. Please help me on this with your valuable answers.
Upvotes: 0
Views: 1611
Reputation: 7834
You can use caching for this Here are the links Cache For Php
Upvotes: 0
Reputation: 1538
Try this code to use web pages with deflate encoded content:
<?php
if (substr_count($_SERVER['HTTP_ACCEPT_ENCODING'], 'gzip'))
ob_start("ob_gzhandler");
else ob_start();
?>
Upvotes: 0