Hello,
I want to display an image, who's location is stored in a string. For Example:
$temp = "Images/UserIcons/Brettsface.png";
But, when i try
<img src= $temp width="100" height="100">
I dont get anything... What have i done wrong?
--Guy
(PS- However, this works <img src= "Images/UserIcons/Brettsface.png" width="100" height="100"> )
How define a variable to display an Image
Moderator: General Moderators
-
guycrossley
- Forum Newbie
- Posts: 9
- Joined: Mon May 12, 2003 8:46 pm
- AVATAr
- Forum Regular
- Posts: 524
- Joined: Tue Jul 16, 2002 4:19 pm
- Location: Uruguay -- Montevideo
- Contact:
Code: Select all
<?php
$temp = "Images/UserIcons/Brettsface.png";
echo '<img src= "'.$temp.'" width="100" height="100">'; //check de simple quotes and the double quotes around $temp
?>you can also leave the php block and do it like;
Code: Select all
<?php
$temp = "Images/UserIcons/Brettsface.png";
?>
<img src=<?php echo $temp; ?> width="100" height="100">So many options... I usually do it like this:
Code: Select all
<?php
print "<img src="$temp" width="100" height="100">";
?>-
guycrossley
- Forum Newbie
- Posts: 9
- Joined: Mon May 12, 2003 8:46 pm
ah, thanks guys. The following code worked:
But this didn't, why?
Is this a database issue, or is there a datatype mismatch or something?
Code: Select all
<?php $temp = "Images/UserIcons/Brettsface.png";
echo '<img src="'.$temp.'">';
?>Code: Select all
<?php $temp = $row_rsUsersї'USER_ICON'];
echo '<img src="'.$temp.'">';
?>-
guycrossley
- Forum Newbie
- Posts: 9
- Joined: Mon May 12, 2003 8:46 pm