Calling the image.php file as part of an image tag in PHP

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Tungsten
    Senior Member
    • Jan 2002
    • 614
    • 3.0.0 Beta 7

    Calling the image.php file as part of an image tag in PHP

    Can one of the resident Jelsoft wizards take a look at this please and tell me if I am doing something wrong, either in function or merely syntax?

    It is part of a template modification that generates a welcome panel. In the welcome panel I refer to some code stashed in the phpinclude_start template that extracts the whereabouts of the user's avatar. Namely, if they even have one and, if so, if it is a pre-defined avatar or a custom avatar.

    If it is a custom avatar, I set a variable as follows...

    Code:
    $welcomeavatar = "<img src=\"image.php?u=$bbuserinfo[userid]&dateline=$avatar[dateline]\" title=\"\" border=\"0\" />";
    For some reason, on my server and the servers of a few other folks, this is working just fine. But on some, the IMG src tag ends up garbled somewhat and the \" are not removing themselves from the code. It ends up breaking the IMG tag and the properties look like this:

    Code:
    [url="http://forums.mydomain.com/"]http://forums.mydomain.com/"image.php?u=$bbuserinfo[userid]&dateline=$avatar[dateline]/[/url]"
    Clearly something isn't parsing properly in the PHP on those select few servers. I've asked the server admins to let me know what version of PHP they are using thinking that perhaps it is a quirk with versions other than 4.3.2.

    Any ideas? Comments, thoughts?

  • Tungsten
    Senior Member
    • Jan 2002
    • 614
    • 3.0.0 Beta 7

    #2
    Figured it out

    Nevermind guys, I figured it out.


    Code:
    $welcomeavatar = '<img src="image.php?u=' . $bbuserinfo['userid'] . '&amp;dateline=' . $avatar['dateline'] . '" title="" border="0" />';

    Apparently PHP version 4.3.2 could handle my original code but any previous versions of PHP would choke on it. I learned something new today!

    Comment

    • merk
      Senior Member
      • Jul 2001
      • 4149

      #3
      Originally posted by Tungsten
      Nevermind guys, I figured it out.

      Code:
      $welcomeavatar = '<img src="image.php?u=' . $bbuserinfo['userid'] . '&amp;dateline=' . $avatar['dateline'] . '" title="" border="0" />';
      Apparently PHP version 4.3.2 could handle my original code but any previous versions of PHP would choke on it. I learned something new today!
      Tungsten i just found something that would interest you.

      PHP Code:
      // ###################### Start getuserinfo #######################
      // set $option to load other relevant information
      function fetch_userinfo(&$userid$option 0)
      {
       global 
      $DB_site$usercache$vboptions$bbuserinfo$permissions$_USEROPTIONS$phrasegroups$usergroupcache;
       
      // Use bitwise to set $option table // see fetch_userinfo() in the getinfo section of member.php if you are confused
       // 1 - Join the reputationlevel table to get the user's reputation description
       // 2 - Get avatar
       // 4 - Process user's online location
       // 8 - Join the customprofilpic table to get the userid just to check if we have a picture
       // 16 - Join the administrator table to get various admin options
       // and so on. 
      That would help for the avatar problems youve been having on the welcome panel, no?

      Comment

      widgetinstance 262 (Related Topics) skipped due to lack of content & hide_module_if_empty option.
      Working...