Go Back   CodingForums.com > :: Server side development > PHP

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 08-05-2012, 05:07 AM   PM User | #1
minkoko
New Coder

 
Join Date: Aug 2010
Location: myeik
Posts: 72
Thanks: 4
Thanked 5 Times in 5 Posts
minkoko can only hope to improve
how to show image in brower with php

Hi Everybody ,
i want to make a show image when i run php file

so, how to write php file with image show in brower

i mean run this localhost/image.php

the image is show in browser

Thanks,
minkoko is offline   Reply With Quote
Old 08-05-2012, 06:43 AM   PM User | #2
Len Whistler
Senior Coder

 
Len Whistler's Avatar
 
Join Date: Jul 2002
Location: Vancouver, BC Canada
Posts: 1,323
Thanks: 26
Thanked 100 Times in 100 Posts
Len Whistler is on a distinguished road
Untested
PHP Code:
<?php

echo "<img src=\"images/photo.jpg\">";

?>
__________________
Leonard Whistler
Len Whistler is offline   Reply With Quote
Old 08-06-2012, 10:53 AM   PM User | #3
MarkR
New Coder

 
Join Date: Sep 2011
Posts: 80
Thanks: 0
Thanked 13 Times in 12 Posts
MarkR is an unknown quantity at this point
PHP Code:

header
('Content-type: image/jpg');
readfile($fullpathtoimg); 
Make sure you adjust the header content type depending on the image type.
__________________
Web Design Newcastle
MarkR is offline   Reply With Quote
The Following 2 Users Say Thank You to MarkR For This Useful Post:
Birlamedisoft (08-09-2012), minkoko (08-09-2012)
Old 08-09-2012, 03:23 AM   PM User | #4
minkoko
New Coder

 
Join Date: Aug 2010
Location: myeik
Posts: 72
Thanks: 4
Thanked 5 Times in 5 Posts
minkoko can only hope to improve
Quote:
Originally Posted by MarkR View Post
PHP Code:

header
('Content-type: image/jpg');
readfile($fullpathtoimg); 
Make sure you adjust the header content type depending on the image type.
Right! i got it ,thanks for advice

Code:
$fullpathtoimg = "eg.jpg";
header('Content-type: image/jpg');
readfile($fullpathtoimg);
thanks Len Whistler
i got two method
minkoko is offline   Reply With Quote
Users who have thanked minkoko for this post:
Birlamedisoft (08-09-2012)
Old 08-09-2012, 05:18 AM   PM User | #5
Birlamedisoft
New to the CF scene

 
Join Date: Aug 2012
Posts: 1
Thanks: 2
Thanked 0 Times in 0 Posts
Birlamedisoft is an unknown quantity at this point
[QUOTE=minkoko;1259163]Right! i got it ,thanks for advice

Code:
$fullpathtoimg = "eg.jpg";
header('Content-type: image/jpg');
readfile($fullpathtoimg);


Thanks for the information. i was also searching for the same from many days.
Birlamedisoft is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:55 PM.


Advertisement
Log in to turn off these ads.