Jump to content

Help with img tab <img src="images/John-Coltrane.jpg">


johnseito

Recommended Posts

Hello all,

 

I was wondering if anyone can help me with putting this code in php. 

 

images is the directory, and John-Coltrane.jpg is the pic in the directory. 

 

So how can I do this if I am trying to get the img out of the directory onto the browser with php. 

 

would it be like this?

Echo "<img src=images/$info['photo']/><br>";

 

images is the directory and $info['photo'] is the name of the img in the sql database, I did this and it doesn't work, any advise?

 

thanks

 

 

 

Link to comment
Share on other sites

The single quotes around the array index name contained in a double-quoted string cause a fatal parse error -

 

Parse error: syntax error, unexpected T_ENCAPSED_AND_WHITESPACE, expecting T_STRING or T_VARIABLE or T_NUM_STRING in ...\your_file.php on line 2

 

Use this -

 

echo "<img src=images/{$info['photo']}/><br>";

Link to comment
Share on other sites

Take a look at the html generated by your php. That'll likely show you what the problem is.  We might need to see a bit more of your php code if you're stuck.

Hello all,

 

I was wondering if anyone can help me with putting this code in php. 

 

images is the directory, and John-Coltrane.jpg is the pic in the directory. 

 

So how can I do this if I am trying to get the img out of the directory onto the browser with php. 

 

would it be like this?

Echo "<img src=images/$info['photo']/><br>";

 

images is the directory and $info['photo'] is the name of the img in the sql database, I did this and it doesn't work, any advise?

 

thanks

 

 

 

 

 

You cannot use that inside of the echo.... If you want to get the image try this one using html..

<?php

codes........

?>

<img src="../John-Coltrane.jpg"> or <img src="images/John-Coltrane.jpg">

<?php

codes..........

?>

 

 

 

 

Link to comment
Share on other sites

Thanks all,

 

Echo "<img src=images".$info[photo]."> <br>"; 

 

this seems to work but I am trying to size the pix, like adding width and height

 

for example like

 

Echo "<img src=images".$info[photo]. width=200 height=200"> <br>"; 

 

and this doesn't work, any idea?

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.