Announcement

Collapse
No announcement yet.

A new way to rotate a banner?

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • Boothby
    replied
    I think the best method is to put this little code into global_start
    PHP Code:
    $banners = array (
         
    'path/to/logo1.gif',
         
    'path/to/logo2.gif',
         
    'path/to/logo3.gif'
    );
    $stylevar['titleimage'] = $banners[array_rand($banners)]; 
    But if you want to use the way you discribed you have to do the following:

    1. Add these lines into a .htaccess file in that path were the banner.jpg is placed.
    PHP Code:
    <Files "banner.jpg">
    AddType application/x-httpd-php .jpg
    </Files
    2. Create the banner.jpg with this content.
    PHP Code:
    <?php
    $banners 
    = array (
         
    'path/to/logo1.gif',
         
    'path/to/logo2.gif',
         
    'path/to/logo3.gif'
    );

    $image realpath($banners[array_rand($banners)]);
    $info GetImageSize ($image);
     
    switch (
    $info[1])
    {
     
    // 1 = GIF, 2 = JPG, 3 = PNG
     
    case 1$header "image/gif"; break;
     case 
    3$header "image/png"; break;
     case 
    2:
     default: 
    $header "image/jpg";
    }
     
    Header("Content-Type: " $header);
    @
    readfile("$image");
    exit;

    ?>
    In both examples you have to edit the paths.

    Leave a comment:


  • Wayne Luke
    replied
    It shouldn't care about the extension unless you have made modifications. It just puts the path into the templates in a simple replacement structure. It doesn't even check to see if the image or path is valid.

    Leave a comment:


  • logicola
    replied
    by banner path, I mean Title Image in the 'header' template, used as the main logo (images/misc/forum_logo.gif.) only gif extension is allowed. I have tried jpg, php etc but in vain.

    How to link banner.jpg to a script that dynamically serves an image to the browser?

    Leave a comment:


  • Wayne Luke
    replied
    vBulletin doesn't have a "banner path".

    The first method is probably exactly the same as the second. banner.jpg just links to a script that dynamically serves an image to the browser.

    Leave a comment:


  • logicola
    started a topic A new way to rotate a banner?

    A new way to rotate a banner?

    I've been to a forum running on vb that has a different way to rotate banners. All the banners to be rotated having the same filename and same address. For instance, the url of the header banner is

    www.forum.com/banners/banner.jpg

    Everytime I refresh it, the banner changes but the url and the filename remain unchanged.

    How to do this??

    There are lots of php banner rotating scripts on the net, each having something like www.forum.com/banners.php as the final url, the url to the banner changes everytime the page is loaded.

    it seems that the first way to rotate a banner is much easier to use in vB. since default vB don't allow .php extension in the banner path.
    Last edited by logicola; Wed 20 Jun '07, 1:44am.

Related Topics

Collapse

Working...
X