Photography club gallery that times out on slow connections
A photography club in Sliema wants a web gallery of 60 competition entries. Each photograph is 4000 × 3000 pixels at 24-bit colour and is currently stored uncompressed. The club's web host gives 500 MB of disk space and the site is viewed mostly on mobile phones over connections of about 5 Mbps. The web designer's first draft simply places all 60 original files on one page. Loading the page on a test phone takes over a minute and the host warns that the site is approaching its disk quota. The club secretary suggests converting everything to PNG because 'PNG is better quality'. The committee wants visitors to see sharp images quickly, and also wants a separate full-resolution download available to judges.
1. Calculate the size of one uncompressed image and of all 60 images. Then estimate how long one image would take to transfer on a 5 Mbps connection. Show your working.
Read the worked answer
One image. 24-bit colour means 3 bytes per pixel.
- Pixels per image = 4000 × 3000 = 12,000,000 pixels.
- Bytes per image = 12,000,000 × 3 = 36,000,000 bytes.
- In megabytes (using 1 MB = 1,000,000 bytes for simplicity, as storage is often quoted) = 36 MB.
- Using binary units, 36,000,000 ÷ 1,048,576 ≈ 34.3 MiB. The difference matters little for the decision.
All 60 images. 36 MB × 60 = 2,160 MB ≈ 2.16 GB. That is more than four times the 500 MB host quota, so the current draft cannot even be fully uploaded.
Transfer time at 5 Mbps. 5 Mbps = 5,000,000 bits per second = 625,000 bytes per second ≈ 0.625 MB/s.
- One image: 36 MB ÷ 0.625 MB/s ≈ 57.6 seconds.
- Sixty images: 2,160 MB ÷ 0.625 MB/s ≈ 3,456 seconds, about 58 minutes of continuous transfer, ignoring overhead.
Real connections rarely reach the headline rate, so the true figure would be worse. The page is not 'slow'; it is structurally impossible on that connection.
2. Recommend a format, resolution and delivery approach that meets the club's goals. Justify each choice and explain why the PNG suggestion is wrong here.
Read the worked answer
Format: JPEG, quality around 80. JPEG is lossy and exploits the fact that human vision is less sensitive to fine colour detail than to brightness. At quality 80 a photograph typically compresses by roughly 10:1 or better with no visible loss at normal viewing size. The images are photographs with continuous tone, which is exactly JPEG's strength.
Resolution: resize to about 1200 × 900 for the gallery. That is 1,080,000 pixels, about 3.24 MB uncompressed. After JPEG compression at 10:1 it is roughly 320 KB. Sixty of those is about 19 MB, comfortably inside the 500 MB quota.
Delivery: separate thumbnails and full view, with lazy loading.
- A thumbnail grid at about 300 × 225 and 30–50 KB each gives a page of roughly 2–3 MB, which loads in a few seconds at 5 Mbps.
- Clicking a thumbnail loads the 1200 × 900 version on demand.
loading="lazy"on images below the fold stops the browser fetching all 60 at once.
Why PNG is wrong. PNG is lossless, so it preserves every pixel - but the source is a photograph with noise and gradients, which PNG compresses poorly. A 1200 × 900 PNG of a photograph could easily be 1.5–2.5 MB, five to eight times the JPEG. The club would pay a large size penalty for 'quality' that no visitor can see on a phone screen. PNG is the right choice for logos, screenshots and images with flat colour or transparency, not for photographic galleries.
Judges' downloads. Keep the originals in a separate protected area, or supply them on request. Do not put 36 MB files behind a public link on a shared host.
3. The host offers 500 MB. The committee also wants to keep the 60 originals on the server for judges. Evaluate whether this is feasible and propose a solution.
Read the worked answer
Not feasible as described. Sixty originals at 36 MB each total about 2.16 GB, which is more than four times the entire 500 MB allowance. Even the resized gallery (about 19 MB) plus thumbnails (about 3 MB) leaves roughly 475 MB, but not 2.16 GB.
Options, with trade-offs:
- Upgrade the hosting plan. If a plan with 5 GB is available at modest cost, this is the simplest route. Trade-off: recurring cost for storage used by a handful of judges.
- Keep originals off the public web server. Put them in cloud storage with expiring share links, or hand judges an encrypted USB drive or a private download link. Trade-off: judges need accounts or a link that must be managed.
- Store compressed originals only. If the camera files are TIFFs or RAW, converting to high-quality JPEG (quality 95) might reduce each to 4–8 MB, giving 240–480 MB. Trade-off: judges are no longer seeing the true original, which may matter for a photography competition.
- Delete after judging. Upload originals temporarily, let judges download them, then remove them. Trade-off: the club must remember to do it, and late judges are excluded.
Recommendation: option 2 combined with option 4. Publish the resized JPEG gallery on the 500 MB host, and distribute originals through a temporary private link that expires after the judging window. This respects the quota, keeps the public site fast, and preserves full quality where it is actually needed. The committee should also record image sizes and quotas in a short handover note, because the next committee will otherwise repeat the mistake.