Jen Jen - 28 days ago 8
PHP Question

Image not showing in php with html

We have am html code saved as .php because it includes a form that requires php. However, the image we've inserted isn't displaying on the browser while everything else is.
Here's our coding:

<IMG SRC = "D:\xampp\htdocs\1.jpg" width = "650" height = "400">


We also tried this :

<?php
$media = fopen("1.jpg", 'r');
echo $media;
fclose($media);
?>


However, it returns "resource id #3" and I don't know how/what else to do to display the image.

Please help.

Answer

if your script is inside a folder in htdocs folder USE

<IMG src="../1.jpg" width = "650" height = "400">

else if your script is inside htdocs folder USE

<IMG src="1.jpg" width = "650" height = "400">

Comments