- Forums
- PHP
- How To Display Pictures Or Image With Php File Script Showing How To Link Photo With Php File
This page will show you how to use a php file to show an image using HTML code. You can display a picture with a php file using a simple php script. This page includes all the necessary script code. [1025], Last Updated: Sat May 18, 2024
wallpaperama
Mon May 14, 2007
3 Comments
18289 Visits
have you ever seen a picture or an image being on a website, and when you see the properties its a php file. with php, you can do these cool tricks.
to do this, just copy and paste this code and save the file as image.php
File
image.php<?php
$img="example.gif";
header ('content-type: image/gif');
readfile($img);
?>
so now lets say you have a webpage and you want the example.gif image to be displayed using this php file, you can.
instead of using this for example:
HTML:
<img src="example.gif">
you can use this instead
HTML:
<img src="image.php" >
The above works like a charm, but if I use a conditional, nothing is returned to the browser.
https://www.wallpaperama.com/forums/how-to-display-pictures-or-image-with-php-file-script-showing-how-to-link-photo-with-php-file-t1344.html