Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.
I have multiple image coordinates saved in a database. I want to pull out the values with a php script. The following works, but I want to make it more efficient with php loop. I am currently using two queries to make it work and I think there would be a better way than how I am doing it. I still need to make sure the images have loaded first. It would be good to get advice.
<script type="text/javascript">
window.onload = function() {
var c=document.getElementById(
var cxt=c.getContext("2d");
var IsImage1Loaded = false;
var IsImage2Loaded = false;
var img=new Image()
img.src="background.jpg";
var secimage=new Image()
secimage.src="../images/<?
img.onload = function() {
IsImage1Loaded = true;
if(IsImage2Loaded) finalCallback();
}
secimage.onload = function() {
IsImage2Loaded = true;
if(IsImage1Loaded) finalCallback();
}
function finalCallback(){
document.getElementById('l
cxt.drawImage(img,0,0);
<?php $thenumb = 1;?>
<?php do { ?>
var secimageXcoord<?php echo $thenumb++;?> = <?php echo $row_rssignplace['coordx']
var secimageYcoord<?php echo $thenumb++;?> = <?php echo $row_rssignplace['coordy']
<?php } while ($row_Recordset1 = mysql_fetch_assoc($Records
<?php $thenumb = 1;?>
<?php do { ?>
cxt.drawImage(secimage,sec
<?php } while ($row_Recordset2 = mysql_fetch_assoc($Records
};
}
</script>
Sign up now to view this solution! It's quick, easy, and secure to subscribe. We will return you to this solution, unlocked, when you’re done.
Posted on 2011-05-09 at 22:51:16ID: 36812548
All comments and solutions are available to Premium Service Members only. Sign up to view the solution to this question. Already a member? Log in to view this solution.