Jump to content


Photo

cache images php javascript


  • Please log in to reply
2 replies to this topic

#1 mattennant

mattennant
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 04 October 2006 - 12:28 PM

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.

<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')">

the attempt that isn't working looks like this

<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)); ?>">

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

#2 mattennant

mattennant
  • Members
  • PipPipPip
  • Advanced Member
  • 42 posts

Posted 04 October 2006 - 09:08 PM

bump

#3 michaellunsford

michaellunsford
  • Members
  • PipPipPip
  • Advanced Member
  • 1,023 posts
  • LocationLouisiana, USA

Posted 05 October 2006 - 12:11 AM

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:
<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);
?>);">





0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users