Web Hosting Talk







View Full Version : Preloading With PHP


GPearce
10-01-2007, 03:39 PM
Hi
I heard there was a string for PHP that can be used to make it load images that wouldn't normally be in the script while it is loading, like a preload?
I couldn't find it on the PHP website, so i thought i would try here :)

Thanks in advance.

Ahmed Tohamy
10-01-2007, 06:38 PM
you can done it with Ajax
jquery.com/demo/thickbox/

foobic
10-01-2007, 08:16 PM
You can preload images with javascript:
if (document.images) {
myImage = new Image(25,25);
myImage.src="http://example.com/image.jpg";
}

This would cause the browser to load the image into memory during page load making it available to appear instantly, say on a rollover. (There is a better way though - combine all states into a single image and use css to control which part of that image is visible.)

Nowhere does PHP come into either option - perhaps you had something different in mind?