Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 5 of 5
  1. #1
    New Coder
    Join Date
    Aug 2010
    Location
    myeik
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 5 Posts

    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,

  • #2
    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
    Untested
    PHP Code:
    <?php

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

    ?>
    Leonard Whistler

  • #3
    New Coder
    Join Date
    Sep 2011
    Posts
    80
    Thanks
    0
    Thanked 13 Times in 12 Posts
    PHP Code:

    header
    ('Content-type: image/jpg');
    readfile($fullpathtoimg); 
    Make sure you adjust the header content type depending on the image type.

  • The Following 2 Users Say Thank You to MarkR For This Useful Post:

    Birlamedisoft (08-09-2012), minkoko (08-09-2012)

  • #4
    New Coder
    Join Date
    Aug 2010
    Location
    myeik
    Posts
    81
    Thanks
    6
    Thanked 5 Times in 5 Posts
    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

  • Users who have thanked minkoko for this post:

    Birlamedisoft (08-09-2012)

  • #5
    New to the CF scene
    Join Date
    Aug 2012
    Posts
    1
    Thanks
    2
    Thanked 0 Times in 0 Posts
    [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.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •