Unable to load Dynamic Images Everytime
Can anyone tell me how SL2b dynamic change imageSource ? This is because I have some images which should get loaded when I access and different Images at each time this is not happening is there any other way to work with this,I wanted to try this out using PHP.
Thanks for your help..
Re: Unable to load Dynamic Images Everytime
This is the solution I use:
Image myImage = new Image();
myImage.Source = new BitmapImage(new Uri("Assets/Images/star_yellow.png", UriKind.Relative));
myCanvas.Children.Add(myImage);
the image folder is located in the web project
you should be able to use the solution for your background
Re: Unable to load Dynamic Images Everytime
Empty alt tag is acceptable, and alt is required for valid XHTML, so making it null is better than not having it.
I don't know if this will make any difference or not, but try "echo" instead of "print" ...
echo "<img id='Template_".$row{'id'}."' name='Template_".$row{'id'}."' src='".$row{'thumburl'}."' width='146' height='146' border='0' alt='' />";
There is a slight speed difference (echo is faster), but it may also be a buffering thing between the server (sending the HTML) and the MySQL query.
This might be another solution:
PHP Code:
$img_id=$row{'id'};
$img_thumb=$row{'thumburl'};
echo "<img id='Template_".$img_id."' name='Template_".$img_id."' src='".$img_thumb."' width='146' height='146' border='0' alt='' />";
Re: Unable to load Dynamic Images Everytime
You may also make use of javascript A javascript array will generate a clickable picture. Put this where you want the images to appear.
Code:
<script type="text/javascript">
var piclink = new Array(4);
piclink[0] = "<a href = 'http://www.link1.htm'><img src='pic1.gif' alt='whatever' style='border:0'></a>";
piclink[1] = "<a href = 'http://www.link2.htm'><img src='pic2.gif' alt='whatever' style='border:0'></a>";
piclink[2] = "<a href = 'http://www.link3.htm'><img src='pic3.gif' alt='whatever' style='border:0'></a>";
piclink[3] = "<a href = 'http://www.link4.htm'><img src='pic4.gif' alt='whatever' style='border:0'></a>";
index = Math.floor(Math.random() * piclink.length);
document.write(piclink[index]);
</script>
You can add as many as you want. Just give them the number that's next in sequence, eg if you want to add one more image make it piclink[4] And you will also need to change the number in new Array(4) to whatever your total is, eg for one more image it will be new Array(5).
If you have to use Frontpage, you should do this in View Source HTML mode. Just copy and paste