-2

I have a problem displaying a blob image from my database using PHP.

I use the following to display the image: echo '<img src="'.$image.'" style="width:300px;height:300px">'; That code shows a broken image. If i click view image info it gives me this:

Location: http://mywebsite.com/12300_110715682290093_100000549846650_157528_4480259_n.jpg
Type: text/html

How can i fix this?

Jens Jørgen
  • 31
  • 1
  • 9
  • the type says it all. the server is outputting text/html, not image/jpeg or whatever it should be. – Marc B Apr 15 '15 at 18:07
  • 1
    You could show the php code that generate the image. Maybe you don't have set the correct headers: http://stackoverflow.com/questions/20714163/proper-header-php-mysql-blob-display-image – manzapanza Apr 15 '15 at 18:11

1 Answers1

0

The best way to show a image from database is to upload the image to a folder where you have your site and then upload the image name to the database.

http://www.w3schools.com/php/php_file_upload.asp here you can read about file upload.

Tell me if you need the code to do it.

Jonathan
  • 49
  • 1
  • 8