MySQL Forums
Forum List  »  PHP

Re: INSERT file path/URL into table
Posted by: Rick James
Date: July 26, 2011 07:19AM

> INSERT INTO image_test
> VALUES (NULL, "https://s3.amazonaws.com/myimagefolder/image1.JPG";;);
Get rid of the first semicolon.

> header('Content-type: image/JPG');
That is used if the PHP script is generating the image, but you don't have the image; it is elsewhere.

When building the html page, use no header (or one that is appropriate for html). Then include in the html either of these:
echo "<img src='$row['image_url']'>" -- without the semicolon!
<img src="<?php echo $row['image_url'] ?>">

Personally, I prefer:
$url = $row['image_url'];
echo "<img src=\"$url\">";

Any of the echos will lead to the _browser_ imbedding the image in the page.

Options: ReplyQuote


Subject
Written By
Posted
Re: INSERT file path/URL into table
July 26, 2011 07:19AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.