random logos

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • badblu01
    Senior Member
    • Feb 2004
    • 231
    • 4.0.0

    random logos

    Hello

    I was wondering if there was code or a program for random logos i have about 4 diffrent title logos i want to use and i want a new one to load each time the forum is visited.

    And i was also wondering if there was such a code or hack will it work with vbadvance homepage?
    Cricket Talk
    All Your Aussie + World Cricket Talk
  • Floris
    Senior Member
    • Dec 2001
    • 37767

    #2
    You could make a file.php in a dir with numbered .gif files and let it rotate through them.
    Then instead of the img you put the <img src="file.php" /> there which will output the imges at random.


    PHP Code:
    <?php
    Header
    ("Content-type: image/gif");
    Header("Cache-Control: no-cache, must-revalidate");
    srand((double)microtime()*1000000);
    $nr rand(14);
    $fn fopen("$nr.gif","r");
    fpassthru($fn);
    ?>
    now you can name your images 1.gif, 2.gif, 3.gif, 4.gif

    example: http://www.vBulletin.nl/files/sig/

    Comment

    • badblu01
      Senior Member
      • Feb 2004
      • 231
      • 4.0.0

      #3
      where abouts in the code do i add the gif name like 1.gif 2.gif and so on.

      I am still new at this

      Thanks for your help
      Cricket Talk
      All Your Aussie + World Cricket Talk

      Comment

      • Floris
        Senior Member
        • Dec 2001
        • 37767

        #4
        Hi again,

        The *.gif you put in the same dir as the .php file. You don't have to modify any image or php file.

        Then instead of your img code in the template (header) you can put <img border="0" src="http://www.yoursite.com/dir/file.php" />

        Comment

        • badblu01
          Senior Member
          • Feb 2004
          • 231
          • 4.0.0

          #5
          Is this what i put in my header code
          <!-- logo -->
          <a name="top"></a>
          <table bgcolor="#FFFFFF" style="BORDER-RIGHT: #337793 1px solid; BORDER-TOP: #337793 1px solid; BORDER-LEFT: #337793 1px solid;" width="$stylevar[outertablewidth]" cellpadding="0" cellspacing="0" align="center">
          <tr><td>
          <table border="0" width="100%" cellpadding="0" cellspacing="0">
          <tr> <td align="center"><a href="$vboptions[forumhome].php?$session[sessionurl]"><img border="0" src="http://aus-scifi.com/forum/file.php" />width="100%" border="0" alt="$vboptions[bbtitle]" /></a></td>
          </tr>
          </table>
          <!-- /logo -->

          and the file.pgp should look like this
          <?php
          Header
          ("Content-type: image/gif"
          );
          Header("Cache-Control: no-cache, must-revalidate"
          );
          srand((double)microtime()*1000000
          );
          $nr = rand(1, 4
          );
          $fn = fopen("$nr.gif","r"
          );
          fpassthru($fn
          );
          ?>



          and the images which are called 1.gif should be uploades to my forum folder with the file.php

          i have done all that and its not working
          Cricket Talk
          All Your Aussie + World Cricket Talk

          Comment

          • badblu01
            Senior Member
            • Feb 2004
            • 231
            • 4.0.0

            #6
            i got t working with

            <?php
            Header("Content-type: image/gif");
            Header("Cache-Control: no-cache, must-revalidate");
            srand((double)microtime()*1000000);
            $nr = rand(1, 5);
            $fn = fopen("1.gif","r");
            $fn = fopen("2.gif","r");
            $fn = fopen("3.gif","r");
            $fn = fopen("4.gif","r");
            $fn = fopen("5.gif","r");
            fpassthru($fn);
            ?>

            but the images are not changing
            Cricket Talk
            All Your Aussie + World Cricket Talk

            Comment

            • badblu01
              Senior Member
              • Feb 2004
              • 231
              • 4.0.0

              #7
              with the php file like this only the last image is showing

              <?php
              Header("Content-type: image/gif");
              Header("Cache-Control: no-cache, must-revalidate");
              srand((double)microtime()*1000000);
              $nr = rand(1, 4);
              $fn = fopen("1.gif","r");
              $fn = fopen("2.gif","r");
              $fn = fopen("3.gif","r");
              $fn = fopen("4.gif","r");
              fpassthru($fn);
              ?>
              Cricket Talk
              All Your Aussie + World Cricket Talk

              Comment

              • badblu01
                Senior Member
                • Feb 2004
                • 231
                • 4.0.0

                #8
                Thanks i found my error and it all works now thanks for your help.
                Cricket Talk
                All Your Aussie + World Cricket Talk

                Comment

                • Floris
                  Senior Member
                  • Dec 2001
                  • 37767

                  #9
                  <img border="0" src="http://aus-scifi.com/forum/file.php" />width="100%" border="0" alt="$vboptions[bbtitle]" /....

                  That isn't right for obvious reasons.

                  Comment

                  • petermw
                    Senior Member
                    • May 2001
                    • 241

                    #10
                    Is there a way to assign different links to the images?

                    I know this is generally called in the HTML portion of the code but thought there might be a php solution to it...

                    Thanks for the tip.

                    P

                    Comment

                    • Dean C
                      Senior Member
                      • Mar 2002
                      • 4571
                      • 3.5.x

                      #11
                      There's no need to use fopen. It's un-necessary file connections. I'd put something like this in phpinclude (untested):

                      PHP Code:
                      $phpversion phpversion();
                      if(
                      $phpversion{0} > 3)
                      {
                              
                      srand((float) microtime() * 10000000);
                              
                      $headers = array("$stylevar[imgdir_misc]/header1.gif""$stylevar[imgdir_misc]/header2.gif""$stylevar[imgdir_misc]/header3.gif");
                              
                      $header array_rand($headers);

                      Dean Clatworthy - Web Developer/Designer

                      Comment

                      • Oblivion Knight
                        Senior Member
                        • Oct 2002
                        • 267
                        • 3.8.x

                        #12
                        I use a simple javascript version.. I've found it's much quicker loading than using PHP.

                        Comment

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