Jump to content


This topic is now archived and is closed to further replies.


cache images php javascript

Recommended Posts

hello there

i'm trying to load a bunch of images from my database into the cache, using php and javascript.

so really im trying to recreate the following bit of code, using a repeat loop.

[code]<body onload="MM_preloadImages('images/uploads/ballettiff.jpg');MM_preloadImages('images/uploads/blue_silk_liberty_t047.jpg');MM_preloadImages('images/uploads/brown_spot_blouse_021.jpg')">[/code]

the attempt that isn't working looks like this

[code]<body onload="<?php do { ?>
<?php echo "MM_preloadImages('"; ?>
        <?php echo $row_all_images['image']; ?>
<?php echo "');"; ?>
        <?php } while ($row_all_images = mysql_fetch_assoc($all_images)); ?>">[/code]

now i'm guessing i need to escape some characters or something, but i'm at a bit of a loss.

any help much appreciated.


Share this post

Link to post
Share on other sites
first off, you can put all your images inside that macromedia preload script -- you don't have to call it for each image. That bein said:
[code=php:0]<body onLoad="MM_preloadImages(<?
while($row_all_images =mysql_fetch_assoc($all_images)) $loadvar.="'images/buttons/".$row_all_images['image']."',";
echo substr($loadvar,0,-1);

Share this post

Link to post
Share on other sites


Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.