Images

Hi there, I’m tryint to call an image if the image row is empty in the database, if not, call the image route sotred in the data base I’m using this

<?php
if ($row_rsDetails[‘RestaurantLogo’]=="" || $row_rsDetails[‘RestaurantLogo’] == NULL)
echo “<img src=images/logos/nologo.gif>”;
else
echo “<img src=“echo $row_rsDetails[‘RestaurantLogo’];”>”;
?>

but I get this

Parse error: parse error, expecting ','' or‘;’’ in /Library/WebServer/Documents/mark/details.php on line **33

**line 33 is echo “<img src=“echo $row_rsDetails[‘RestaurantLogo’];”>”;

what am I doing wrong?

Thanks guys

Arturo

echo "<img src="echo $row_rsDetails['RestaurantLogo'];">";

When you use double quotes inside double quotes (or single quotes inside single quotes) you need to delimit the quotes that you wish to display.

So you like could look like:

echo "<img src=\"$row_rsDetails['RestaurantLogo']\">";

Or:

echo '<img src="' . $row_rsDetails['RestaurantLogo'] . '">';

thanks a lot, many thanks!!, just one thing, how I can place the size of the image? because my image is kinda’ big I’ll like to place something like 80x53 pxls, my code now is

<?php
if ($row_rsDetails[‘RestaurantLogo’]==“” || $row_rsDetails[‘RestaurantLogo’] == NULL)
echo “<img src=images/logos/nologo.gif>”;
else
echo ‘<img src="’ . $row_rsDetails[‘RestaurantLogo’] . ‘">’;
?>

thanks Ankou

are you basiclaly looking to resize the large image or are you going to make a separate thumbnail file? i would recommend making a thumbnail over resizing the large image b/c you will cut down on bandwidth drastically.

oh no, my image is 150x100 but that page is a search detail so I need the image reduced in order to fit in the page to 80x53, I know there’s a way to place the size in the img tag, but don’t know how to do this with this treatment but is not working:

<?php
if ($row_rsDetails[‘RestaurantLogo’]==“” || $row_rsDetails[‘RestaurantLogo’] == NULL)
echo “<img src=images/logos/nologo.gif>”;
else
echo ‘<img src="’ . $row_rsDetails[‘RestaurantLogo’] . ‘" width=“80” height=“53”>’;
?>

thanks a lot!!


echo '<img src="' . $row_rsDetails['RestaurantLogo'] . '" width="80" height="53">';

^this should work. are you getting an error message or what is the screen displaying that lets you know it’s not working?

<?php
if ($row_rsDetails['RestaurantLogo']=="" || $row_rsDetails['RestaurantLogo'] == NULL){
echo "<img src=images/logos/nologo.gif>";
}
else{
echo '<img src="' . $row_rsDetails['RestaurantLogo'] . '" width="80" height="53">';
}
?>

btw arturo, you should use the [noparse]

here's my php code

[/noparse] tags so that your code is sectioned off and color coded.

hi there, well, I’m not getting any error, but the image it’s at full size

(-:

when you view the resulting html, what is the output?

check this

www.videoestudio.net/mark

then click on West Palm Beach button

Thanks bwh2!