How to display an image from a folder using PHP variable in a HTML tag?

Nibur

I just want to display an image from a directory using PHP. But I could not. I have tried all the below ways.

enter image description here

<?php

/* Getting file name */
$document_root = $_SERVER['DOCUMENT_ROOT']; 
$replace =  str_replace('/',"\\",$document_root);
$filename = "/excel.png";
//$image_path = $replace."\imagesupload\uploads".$filename;
$image_path = $document_root."/imagesupload/uploads".$filename;
echo $image_path;  
 //echo '<img src="../admin/upload/' . $display_img . '" width="' . $width . 'px" height="120px"/>';
?>
<html>
    <body>
        <img src="<?php echo $image_path; ?>" />
   </body>
</html>

The above code gives the following output. But the path I gave was correct.

Rubin Anbin

I think this one will help you

<img src="uploads/<?php echo $file.png;?>" />

Collected from the Internet

Please contact [email protected] to delete if infringement.

edited at
0

Comments

0 comments
Login to comment

Related

How to Set Image as a Variable in Php and display the image in HTML using that variable

how to display an image on xamarin forms using binding tag from image

Display a random image from the folder using session with PHP

How to display an image from external folder in a html page

Display images from folder in table using php,html?

how Html helper tag to display dynamically image

Display folder of images in html using php

How to save image from URL in server folder using php or javascript?

How to split xml tag variable and display with php

How to display Original image from folder codeignihter

how to display posts image from wordpress blog in html/php page

How to Remove image tag from display

How to display message in HTML Tag with PHP in a function

Get image from JSON file using JavaScript and display in HTML img tag

How to display a variable from a typescript file to a html file using Angular?

How to display image from RSS feed using PHP

Using a JavaScript variable to link an image in a image tag in HTML with DOM

How to add image in to HTML from different folder

How to fetch whole data from php and display it in html using AJAX

How to display a link from the MySql database in html using jquery or php

Display image from curl request in html<img> tag

How to delete an image from a folder in PHP

How to fill an html tag with a variable from javascript

How to display image from variable in react native

How to return to the DOM a string variable from controller that contains an html image tag with asset() function in src?

Display image from MySQL using PHP not working

Display an image from a MySQL database using PHP

play video from www folder using html video tag ( on android )

Display Image from source folder

TOP Ranking

HotTag

Archive