Centering and Rotating Banner

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • wangstathug
    New Member
    • Feb 2007
    • 29

    Centering and Rotating Banner

    Hello all. Have been out of the game for awhile with VB, so I need to re-learn all of this.

    Here is the site: www.chicagoholdenconnection.com/forum

    I need to know how to center that banner and then how do I make it show a different banner every time the page is loaded?

    For example, look here: www.ls2gto.com

    Thanks in advance.
  • MsJacquiiC
    Senior Member
    • Nov 2006
    • 325
    • 3.8.x

    #2
    Hey - Seems like you have the image centered correctly - Probably used a <div align="center"> tag right?

    As far as rotating banner - there is php scripts available that would accomplish what you need... One that I use on one of my sites:

    PHP Code:
    <?php

    /*

        AUTOMATIC IMAGE ROTATOR
              http://www.hiveware.com/imagerotator.php

        INSTRUCTIONS
        1. Modify the $folder setting in the configuration section below.
        2. Add image types if needed (most users can ignore that part).
        3. Upload this file (rotate.php) to your webserver.  I recommend
           uploading it to the same folder as your images.
        4. Link to the file as you would any normal image file, like this:

                <img src="http://example.com/rotate.php">

        5. You can also specify the image to display like this:

                <img src="http://example.com/rotate.php?img=gorilla.jpg">
            
            This would specify that an image named "gorilla.jpg" located
            in the image-rotation folder should be displayed.
        
        That's it, you're done.

    */




    /* ------------------------- CONFIGURATION -----------------------


        Set $folder to the full path to the location of your images.
        For example: $folder = '/user/me/example.com/images/';
        If the rotate.php file will be in the same folder as your
        images then you should leave it set to $folder = '.';

    */


        
    $folder '.';


        
    $extList = array();
        
    $extList['gif'] = 'image/gif';
        
    $extList['jpg'] = 'image/jpeg';
        
    $extList['jpeg'] = 'image/jpeg';
        
    $extList['png'] = 'image/png';
        

    // You don't need to edit anything after this point.


    // --------------------- END CONFIGURATION -----------------------

    $img null;

    if (
    substr($folder,-1) != '/') {
        
    $folder $folder.'/';
    }

    if (isset(
    $_GET['img'])) {
        
    $imageInfo pathinfo($_GET['img']);
        if (
            isset( 
    $extListstrtolower$imageInfo['extension'] ) ] ) &&
            
    file_exists$folder.$imageInfo['basename'] )
        ) {
            
    $img $folder.$imageInfo['basename'];
        }
    } else {
        
    $fileList = array();
        
    $handle opendir($folder);
        while ( 
    false !== ( $file readdir($handle) ) ) {
            
    $file_info pathinfo($file);
            if (
                isset( 
    $extListstrtolower$file_info['extension'] ) ] )
            ) {
                
    $fileList[] = $file;
            }
        }
        
    closedir($handle);

        if (
    count($fileList) > 0) {
            
    $imageNumber time() % count($fileList);
            
    $img $folder.$fileList[$imageNumber];
        }
    }

    if (
    $img!=null) {
        
    $imageInfo pathinfo($img);
        
    $contentType 'Content-type: '.$extList$imageInfo['extension'] ];
        
    header ($contentType);
        
    readfile($img);
    } else {
        if ( 
    function_exists('imagecreate') ) {
            
    header ("Content-type: image/png");
            
    $im = @imagecreate (100100)
                or die (
    "Cannot initialize new GD image stream");
            
    $background_color imagecolorallocate ($im255255255);
            
    $text_color imagecolorallocate ($im0,0,0);
            
    imagestring ($im255,  "IMAGE ERROR"$text_color);
            
    imagepng ($im);
            
    imagedestroy($im);
        }
    }

    ?>
    The instructions is in the php code above... Basically - Copy that text into a text editor and name it random.php - place it in a folder with your header images and link to the php file as your image as in:

    HTML Code:
    <img src="http://sitename.com/images/imagefolder/random.php" border="0">
    I like the php method because it can even be used in css design to randomize your images.

    Anyway - HTH

    Jacquii.



    "Question my skill set perhaps, but never question my heart." -- JacquiiCooke.com

    Comment

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