- Forums
- PHP
- How To Display An Image With Php File Showing Pictures With Php Files
This Page Contains information about How To Display An Image With Php File Showing Pictures With Php Files By wallpaperama in category PHP with 0 Replies. [1131], Last Updated: Sat May 18, 2024
wallpaperama
Sat Mar 08, 2008
0 Comments
1831 Visits
if you want to know how you can display image, pictures photos or pics using a php file you can use this
first create a php file called webune-image.php
now copy and paste the code below:
<?
# SCRIPT BY WEBUNE.COM - PHP HOSTING
# PLEASE DONT REMOVE THIS PART. THANK YOU
$ImgOutput = "absolute/path/to/image.jpg";
?>header ('content-type: image/jpg');
readfile($ImgOutput);
?>
now where it says
$ImgOutput make sure to give the correct path where the image is located at
for example, if you have an jpg image in your images directory and your image is called default.jpg
you would declare it like this
$ImgOutput = "/var/www/html/images/default.jpg";
not like this: http://www.mywebsite.com/images/default.jpg
now open create another empty file called webune.html and copy and paste the following code:
<img src="http://www.mywebsite.com/webune-image.php" alt="created by webune">
now you want to open webune.html with your browser.
make sure to change
mywebsite.com to whatever yous website is.
this is the very basic of a file, you can be more creative, but atleast it gives you a guide on how this works.