Page 1 of 1

Won't Show Images

Posted: Sun Jul 17, 2005 12:48 am
by dynamic_desi
Hi,

It has not been long i started learning php and mysql. Using simple HTML code the same tags show images perfectly. But as soon as i try and integrate them with a php code it has troubles showing the images. As a matter of fact it does not display any images.

This is what i am trying to do.

<?php
session_start();
include ( 'functions.php');
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css"
href="main.css" />
</head>
<body>
<table align = "center" border="0" cellpadding ="1" cellspacing="1">
<tr>
<td class="header" height="70" colspan ="2" valign="bottom">
<a href="templet.php">Login</a> |<a href="main.php"> Home</a> | Back </td>
<td colspan ="1">
<?

$images = '<img src="/var/www/html/usflag.jpg">';

echo $images;

?></td>
</tr>
<tr>

<!--rest of the code-->

Even tried this

<?php
session_start();
include ( 'functions.php');
?>
<html>
<head>
<title></title>
<link rel="stylesheet" type="text/css"
href="main.css" />
</head>
<body>
<table align = "center" border="0" cellpadding ="1" cellspacing="1">
<tr>
<td class="header" height="70" colspan ="2" valign="bottom">
<a href="templet.php">Login</a> |<a href="main.php"> Home</a> | Back </td>
<td colspan ="1"><img src="/var/www/html/usflag.jpg">
</td>
</tr>
<tr>

<!--rest of the code-->

and this

<img src="http://mydomainname.org/dir/usflag.jpg">

won't work either...

What am i doing wrong????

Any help would be a great favor

thanking you in advance...

dynamic_desi :(

Posted: Sun Jul 17, 2005 1:00 am
by imstupid
for starters, to keep it simple, instead of setting a variable, you could try this first:

Code: Select all

<? 

echo "<img src='/var/www/html/usflag.jpg'>" ; 

?>
if that ain't workin, you might have to escape those quotes:

Code: Select all

<?PHP
echo "<img src=\"/var/www/html/usflag.jpg\">" ; 
?>
I don't know when or why you need to escape quotes since I'm not very good at php. good luck.ng a variable, you could try this first:

Code: Select all

<? 

echo "<img src='/var/www/html/usflag.jpg'>" ; 

?>
if that ain't workin, you might have to escape those quotes:

Code: Select all

&lt;?PHP
echo &quote;&lt;img src=\&quote

Code: Select all

<? 

echo "<img src='/var/www/html/usflag.jpg'>" ; 

?&gt;
if that ain't workin, you might have to escape those quotes:

Code: Select all

<?PHP
echo "<img src=\"/var/www/html/usflag.jpg\&ampuote;<img src='/var/www/html/usflag.jpg'>" ; 

?>
if that ain't workin, you might have to escape those quotes:

Code: Select all

<?PHP
echo &quotlt;? 

echo "<img src='/var/www/html/usflag.jpg'>" ; 

?>
if that ain't workin, you might have to escape those quotes:

Code: Select all

<?PHP
echo "<img src=\"/var/www/html/usflag.jpg\">" ; 
?>
I don't know when or why you need to escape quotes since I'm not very good at php. good luck.eep it simple, instead of setting a variable, you could try this first:

Code: Select all

<? 

echo "<img src='/var/www/html/usflag.jpg'>" ; 

?>
if that ain't workin, you might have to escape those quotes:

Code: Select all

<?PHP
echo "<img src=\"/var/www/html/usflag.jpg\">" ; 
?>
I don't know when or why you needeep it simple, instead of setting a variable, you could try this first:

Code: Select all

<? 

echo "<img src='/var/www/html/usflag.jpg'>" ; 

?>
if that ain't workin, you might have to escape those quotes:

Code: Select all

<?PHP
echo "<img src=\"/var/www/html/usflag.jpg\">" ; 
?>
I don't know when or why you need to escape quotes since I'm not very good at php. good luck.:

Code: Select all

<? 

echo "<img src='/var/www/html/usflag.jpg'>" ; 

?>
if that ain't workin, you might have to escape those quotes:

Code: Select all

<?PHP
echo "<img src=\"/var/www/html/usflag.jpg\">" ; 
?>
I don't know when or why you need to escape quotes since I'm not very good at php. good luck.
<?

echo "<img src='/var/www/html/usflag.jpg'>" ;

?>


if that ain't workin, you might have to escape those quotes:

Code: Select all

<?PHP
echo "<img src=\"/var/www/html/usflag.jpg\">" ; 
?>
I don't know when or why you need to escape quotes since I'm not very good at php. good luck.

Still won't work

Posted: Sun Jul 17, 2005 2:07 am
by dynamic_desi
Hi,

I tried this
<?php

echo '<img src="usflag.jpg">';

?>

image is under the root dir of apache..

. However it works like a charm on my other windows machine. But my centOS box where i am hosting my site won't run the script at all.

It totally outta scope of my php skills on troubleshooting this problem.

dynamic_desi

Got it to work

Posted: Sun Jul 17, 2005 2:41 am
by dynamic_desi
Hi Guys,

Thanks for all the help, finally i got it to work.

dynamic_desi

Got it to work

Posted: Sun Jul 17, 2005 2:43 am
by dynamic_desi
Sorry about that...did not post the solution

I moved the image file ---usflag.jpg to my apaches root dir and used this script

<?php

echo '<img src="/usflag.jpg">';

?>

worked fine, all it needed was a "/" infront of the file name

thanks again

Posted: Sun Jul 17, 2005 12:55 pm
by s.dot
Hmm for future reference..

To make your code easier to read (and to follow forum guidelines) you should use the PHP and Code tags to display your code. :)