Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

How can I speed up a website with a large image gallery?


I just built a website for a local artist's portfolio. However when it loads it's VERY slow. I'm guessing this is because I have lots of images (in .jpg) format on the page. Is there anyway I can speed up this load time? I'm assuming maybe changing the images somehow might work, but I'm not sure.


You can see the website here: www.Spirited-Artistry.com

3 Answers

Hmm, it's not actually too slow I'd say. My internet is on the lower end of the quality spectrum (3Mbps DL), and it went alright.

If you really wanted to speed things up, I'd suggest showing less images, maybe adding a "load more" option, so if a user wishes to see more works, the images could be loaded then. Compression may have to be an option in the end.

This blog post has some good ideas of how to get rid load times related to images.

Edit: PS, there's a small white bar at the very bottom of that website (on the latest Chrome at least). Not sure if that was intentional.

Hi Josh,

Some of those images are really large. Your total page size is around 12.4MB.

As far as I can tell you're displaying the thumbnails at 175x175 and showing them in the lightbox at 300x300. If that is the largest you're displaying the image on the site then you need to optimize your images. You have some images that are around 1MB in size and a couple of thousand pixels in both dimensions.

Also, the native size of your images aren't square but you're showing them square on the site which means they're being scaled disproportionately.

I would recommend that you either crop the images square or let them be rectangular in the lightbox maintaining their native proportion.

You want to scale them down as well to the largest you will display them on the site. This keeps the file size down.

With 15 thumbnails on the page I think a good goal for total page size should be under 1MB.

Thanks guys! I'll try that and see how it goes.