How To Get The Image

Discussion in 'PHP' started by kumar84, Aug 10, 2007.

  1. #1
    Hi friends


    How to retreive the picture from an array,

    In my program
    $fields = array("picture");
    $userid=100
    if I pass these two in my method

    To get the picture If i print the array value means it is giving me only the link
    http://profile.ak.facebook.com/profile5/45/35/s731487500_7.jpg
    not the picture

    so i need of the picture that i have uploaded, not the link

    IN order to get the picture what i want to do
    any body knows the code for this in PHP
     
    kumar84, Aug 10, 2007 IP
  2. ecentricNick

    ecentricNick Peon

    Messages:
    351
    Likes Received:
    13
    Best Answers:
    0
    Trophy Points:
    0
    #2
    instead of printing just the array value...

    
    echo array("picture");
    
    PHP:
    you need to echo out the img tags....

    
    echo '<img src="'.array("picture").'">';
    
    PHP:
     
    ecentricNick, Aug 10, 2007 IP
  3. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #3
    Ummm... you cannot echo arrays like that. It should be:
    
    $fields = array("picture");
    echo '<img src="'. $fields[0] .'">';
    
    PHP:

    But if you'd rather output the image without <img> tags, you can do:
    
    
    $fields = array("picture");
    
    header('Content-Type: image/jpeg');
    readfile($fields[0]); // Path to image
    exit();
    
    PHP:
     
    nico_swd, Aug 10, 2007 IP