Jump to content

cache images php javascript


mattennant

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.

mat
Link to comment
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);
?>);">
[/code]
Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

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.