Page 1 of 1

Slow loading JPEGs

Posted: Fri Sep 19, 2008 11:57 am
by Sheridan
I have created a site which has JPEG files. For some reason they load very, veerrrrrry sloooowwwwwllllly.

I am using the standard HTML img src code. Is there anything I can do to speed the process?

Re: Slow loading JPEGs

Posted: Fri Sep 19, 2008 12:02 pm
by panic!
it really depends where your bottleneck is. You haven't really been descriptive enough at all.

Where is it hosted? Are the images being processed/created by GD or just plain JPGs? How big are they?

Re: Slow loading JPEGs

Posted: Sat Sep 20, 2008 10:56 am
by josh

Re: Slow loading JPEGs

Posted: Sat Sep 20, 2008 11:21 am
by califdon
Sheridan wrote:I have created a site which has JPEG files. For some reason they load very, veerrrrrry sloooowwwwwllllly.

I am using the standard HTML img src code. Is there anything I can do to speed the process?
How many files? How big are they, on average? For an entire web page, what is the total number of kilobytes that must load? What is the speed of your Internet connection? Where is the site hosted? Those are just a few of the questions you would have to answer before any kind of a sensible answer could be given.

Re: Slow loading JPEGs

Posted: Sat Sep 20, 2008 2:34 pm
by Sheridan
How many files? - 10 JPEG files

How big are they, on average? - 1.15 MB - 1.35 MB

For an entire web page, what is the total number of kilobytes that must load? - 13.5 MB Max

What is the speed of your Internet connection? It's a DSL connection running at 760 Kbps, Max

Where is the site hosted? - On a home computer. XP on a Pentium II with 512 MB RAM running at 299MHz

Re: Slow loading JPEGs

Posted: Sat Sep 20, 2008 3:51 pm
by onion2k
Sheridan wrote:For an entire web page, what is the total number of kilobytes that must load? - 13.5 MB Max
A 1.15MB image downloading on a 760kbps connection takes 12.39s .. plus a bit for the browser to work out what to get. The entire page is going to take a long time - 2.4 minutes in fact. That's far too much, especially when you realise very few people's connections actually go at maximum speed.

If you want your site to appear to load quickly you need to get the entire page (all HTML, CSS, JS, images, Flash, etc) under 200kb (approximately 1/500th the size of your current page). And even that is considered a lot. When I started out in web development a decade ago 40kb was considered huge.

Re: Slow loading JPEGs

Posted: Sat Sep 20, 2008 4:54 pm
by daniel142005
Sheridan wrote:How many files? - 10 JPEG files

How big are they, on average? - 1.15 MB - 1.35 MB

For an entire web page, what is the total number of kilobytes that must load? - 13.5 MB Max

What is the speed of your Internet connection? It's a DSL connection running at 760 Kbps, Max

Where is the site hosted? - On a home computer. XP on a Pentium II with 512 MB RAM running at 299MHz
Is the computer's internet connection on the same as yours? and are you accessing it across the network?

If they are sharing the same connection then your upload speed is probably around 100-300kbps which would slow them down even more. This doesn't apply for you if you are trying to view them on the network but it will apply for anyone outside your network (assuming it isn't specifically for local access). Also, the computer the site is hosted on is quite slow... My phone is running at 600MHz with 256mb of ram... so its possible that some performance can be lost there as well.

Another solution, if you don't really need the whole image to be loaded, is to either have GD Library (php) scale down the images before sending them (caching the small ones to prevent the server from having to generate them every time), then allow you to click them for full size, or you make two copies yourself and link to the larger one from the small ones.

Re: Slow loading JPEGs

Posted: Sat Sep 20, 2008 8:06 pm
by califdon
Sheridan wrote:How many files? - 10 JPEG files

How big are they, on average? - 1.15 MB - 1.35 MB

For an entire web page, what is the total number of kilobytes that must load? - 13.5 MB Max

What is the speed of your Internet connection? It's a DSL connection running at 760 Kbps, Max

Where is the site hosted? - On a home computer. XP on a Pentium II with 512 MB RAM running at 299MHz
Yeah, that's just never going to be a workable site for outsiders to visit. To begin with your DSL connection is probably ADSL, with an upload speed of maybe 100 kbps. Your web server has only a half gigabyte RAM. If everything is running at top efficiency, the best you could hope to get would be a load time of something like 13,500 / (100 / 8 ) = 1080 seconds or 18 minutes. It's too bad, but images for web viewing need to be very small. Even if you hosted that page on a commercial hosting service, it would be miserably slow. You are probably wasting that resolution anyway, since a typical viewer's screen size is perhaps 1280 x 1024 at most (1,310,720 pixels) at 3 bytes per pixel (for 16 million colors), so even a fullscreen image would be only around 4 mB. In any case, those jpeg are just not suitable for a web site, especially 10 of them on a page. You need to use PhotoShop or similar software to reduce the resolution.

Re: Slow loading JPEGs

Posted: Sun Sep 21, 2008 9:02 am
by Sheridan
Thanks for clearing up the tech details, everyone. I decided to use GD to produce thumbnails href linked to the full size images. The page loads beautifully now.