PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
Has anyone got any ideas on preloading images that are dynamically generated by php?
I've written a script that thumbnails images for a shopping cart with associated mouseover images and also overlays an image depending on certain conditions (New item, special offer etc.)and the image code in the html looks something like this
So basically I could really do with finding a way to preload the mouseovers. I'm thinking it's maybe not possible because thumbs.php is always called by 'img src=' and hence processes the source img regardless of whether it's cached by the browser or not but if anyone can come up with a solution it would be greatly appreciated.
You could use the standard (boring, crappy) javascript preload image technique, or you could try some fancy CSS flicker-free rollovers. Google search for the technique if you're interested.
Also, if it's server time your concerned about, you could cache the images.
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
I think i've sorted my problem, i'm just generating the thumbnails at the point of uploading the source image, that should sort the page load time out a bit and allow me to preload the rollovers, it means i have to recreate the thumb everytime the settings for the associated product change to 'new', 'special offer' or 'sold out' but it turns out be easier than i thought. thanks for your replies,
carlos
A cut down version of the code if anyone needs to create a thumbnail of an image they are uploading:
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]