Manual caching

Posted on 2008-11-06
Medium Priority
Last Modified: 2009-12-16

Is it possible to get php to manually cache all images for a website when the home page is loaded, allowing the other pages to load more quickly? This may or may not be a good idea, but the site is small so the total number of images will take about 5 secs on a 10Mbit line. The graphics are complex and need to be single jpgs rather than css trickery.

  • 3
  • 2
LVL 111

Accepted Solution

Ray Paseur earned 2000 total points
ID: 22895946
Have you tried putting the images into the $_SESSION array?  You might also want to look into memcached.

And you might also want to look into higher JPG compression or combining small images into larger ones.  The overhead to load each little image is the same as the overhead to load one large image.  This overhead may turn out to be greater than the extra work required for the one large image!

best regards, ~Ray
LVL 111

Expert Comment

by:Ray Paseur
ID: 22895968
Also, post a link to the site with the graphics on it - there may be other ideas once I have seen what you are doing now.

Thanks, ~Ray

Author Comment

ID: 22896660

the site is currently comprising of several medium sized images (1000*300 or 400*400 etc.). The link is:
LVL 111

Expert Comment

by:Ray Paseur
ID: 22896808
Your site seems very fast - the pages loaded instantly.  I would not worry too much about this if I were you.  

You cannot control the speed of the client connection, and the site may appear slow to anyone using dial-up or slow connections, but on a T-1 it's just fine.

If you are concerned about the speed on a slow connection, your only choice is to redesign the site to use lower-weight graphics.  But as I said, its inherent performance looks great to me.

Best regards, ~Ray

Author Comment

ID: 22897276

I've been trying to find percentages of people using broadband as oppose to dial-up because I'm on a 10MBit line and I'm not sure how many other people are. I would expect the site to be promoted to other people with quite high connections due to the nature of the content and the artists promoted and so it wouldnt be a huge problem but it was interesting to find out. I'll check out the solutions you mentioned in the first post never the less.


Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The title says it all. Writing any type of PHP Application or API code that provides high throughput, while under a heavy load, seems to be an arcane art form (Black Magic). This article aims to provide some general guidelines for producing this typ…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses
Course of the Month13 days, 20 hours left to enroll

807 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question