How to insert an image in PHP ???

Discussion in 'PHP' started by NYDAz, Feb 8, 2007.

  1. #1
    Hi everybody.
    I've downloaded a members area script, and I don't know how to put some pictures when the users has logged in ...

    the code where I should tweak something is this
    if($session->logged_in){
       echo "<h1>Logged In</h1>";
       echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
           ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;"
      ---------> I NEED TO INSERT SOME IMAGES HERE, HOW CAN I DO THAT <--------------
           ."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;";
       if($session->isAdmin()){
          echo "[<a href=\"admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;";
       }
       echo "[<a href=\"process.php\">Logout</a>]";
    }
    else{
    Code (markup):
    help me ... please

    :D
     
    NYDAz, Feb 8, 2007 IP
  2. aplus

    aplus Well-Known Member

    Messages:
    83
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    115
    #2
    Try this :

    if($session->logged_in){
       echo "<h1>Logged In</h1>";
       echo "Welcome <b>$session->username</b>, you are logged in. <br><br>"
           ."[<a href=\"userinfo.php?user=$session->username\">My Account</a>] &nbsp;&nbsp;"
    
    ."<img src=\"path/to/image.jpg\" >"
    
           ."[<a href=\"useredit.php\">Edit Account</a>] &nbsp;&nbsp;";
       if($session->isAdmin()){
          echo "[<a href=\"admin/admin.php\">Admin Center</a>] &nbsp;&nbsp;";
       }
       echo "[<a href=\"process.php\">Logout</a>]";
    }
    else{
    PHP:
     
    aplus, Feb 8, 2007 IP
  3. NYDAz

    NYDAz Peon

    Messages:
    685
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #3
    aplus ... it worked ... thanks

    BUT now I want to link the image, to open the full size in a new window !!

    how to that ... just like HTML ?

    thanks in advance ;)
     
    NYDAz, Feb 8, 2007 IP
  4. Icheb

    Icheb Peon

    Messages:
    1,092
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #4
    Can you not derive what you have to do from the rest of the code and from what has been posted here? That is sad.
     
    Icheb, Feb 8, 2007 IP
  5. aplus

    aplus Well-Known Member

    Messages:
    83
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    115
    #5
    
    
    
    ."<a href=\"http://www.mydomain.com\" alt=\"mytitle\"><img src=\"path/to/image.jpg\" ></a>"
    
    
    PHP:
     
    aplus, Feb 8, 2007 IP
  6. NYDAz

    NYDAz Peon

    Messages:
    685
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #6
    I can derive, but I wanted to be sure .... stay chill :p
     
    NYDAz, Feb 8, 2007 IP
  7. Icheb

    Icheb Peon

    Messages:
    1,092
    Likes Received:
    31
    Best Answers:
    0
    Trophy Points:
    0
    #7
    So you couldn't just test it to "be sure"? Would have been soooo much faster.
     
    Icheb, Feb 8, 2007 IP
  8. NYDAz

    NYDAz Peon

    Messages:
    685
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #8
    Nope ... so please stop posting, just for fun ... your posts are no usefull for this topic .... please understand :)
     
    NYDAz, Feb 8, 2007 IP
  9. aplus

    aplus Well-Known Member

    Messages:
    83
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    115
    #9
    If you think you know, then test it to see if it works.
    if you really want to learn, then you will need to test.
     
    aplus, Feb 8, 2007 IP
  10. TwistMyArm

    TwistMyArm Peon

    Messages:
    931
    Likes Received:
    44
    Best Answers:
    0
    Trophy Points:
    0
    #10
    NYDAz: regarding your question...

    "how to that ... just like HTML ?"

    Remember: PHP is a server side language that outputs HTML. Things like that ("how to make a link" etc.) HAVE to be like HTML, because the output of PHP HAS to be HTML (in instances where you want it to show in a browser).

    Just thought I would clarify that for you.
     
    TwistMyArm, Feb 8, 2007 IP
  11. NYDAz

    NYDAz Peon

    Messages:
    685
    Likes Received:
    9
    Best Answers:
    0
    Trophy Points:
    0
    #11
    Thanks ... Twist ... nice tips :)

    I will rember them ...

    Cheers ;)
     
    NYDAz, Feb 8, 2007 IP