Link Farm Code
  Home arrow Link Farm Code arrow FreshSoftware Banner Image Rotater
Try It Free
Codewalker Forums 
  Tutorials  
Database Articles  
Miscellaneous  
Navigation Usability  
PEAR Articles  
Programming Basics  
Server Administration  
XML Tutorials  
  Reviews  
Database Book Reviews  
Linux Book Reviews  
Miscellaneous Reviews  
PHP Book Reviews  
PHP Software Reviews  
Server Admin Reviews  
SQL Tool Reviews  
  Code Gallery  
Content Management Code  
Contest Code  
Counters Code  
Database Code  
Date Time Code  
Discussion Board Code  
Email Code  
File Manipulation Code  
GUI Code  
Link Farm Code  
Miscellaneous Code  
Search Code  
Site Navigation Code  
User Management Code  
Forums Sitemap 
Dedicated Servers  
Download TestComplete 
IBM® developerWorks
Weekly Newsletter 
 
Developer Updates  
Free Website Content 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us Get Paid 
Request Media Kit
Contact Us 
Site Map 
Privacy Policy 
Support 
 USERNAME
 
 PASSWORD
 
 
  >>> SIGN UP!  
  Lost Password? 
LINK FARM CODE

FreshSoftware Banner Image Rotater
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 1
    2004-09-24

    Table of Contents:

    Rate this Article: Poor Best 
      ADD THIS ARTICLE TO:
      Del.ici.ous Digg
      Blink Simpy
      Google Spurl
      Y! MyWeb Furl
    Email Me Similar Content When Posted
    Add Developer Shed Article Feed To Your Site
    Email Article To Friend
    Print Version Of Article
    PDF Version Of Article
     
    Try It Free
     
    ADVERTISEMENT

    Stay one step ahead of the competition. Evaluate and give feedback on some of the hottest web development tools on the market today. Make your opinion heard! Click Here

    A PHP script that automatically rotates randomally selected banner images.

    By : thebomani

    <?
    /*
    *******************************
    FreshSoftware Banner Image Rotater
    Version: 1.0
    *******************************

    *******************************
    Intention
    *******************************
    This script is a script desigend to display random banner images in
    jpg, gif and png formates. This script can also be modified to display
    any other file type by altering the $image_ext_array array bellow. Notice that
    the ARRAY_RAND function may choose the same file many times before selecting a different file.

    *******************************
    System Requirments.
    *******************************
    1. PHP 4.2.0 or higher.
    2. A Unix based Opertating System.
    3. A Web Server (Apache Perphered).
    4. Executable priviages on your server.
    Even in Safe Mode the PWD command is available
    provided that the executable directory has the same UID
    as this script.

    *******************************
    Author.
    *******************************
    This script was designed by Sulaiman Aleem of FreshSoftware.net. Send questions to
    webmaster@freshsoftware.net

    To watch this script in action visit http://www.freshsoftware.net/images/advertisments/freshsoftware/index.php

    *******************************
    HOW TO INSTALL
    *******************************

    1) Copy this file to a directory that is accessbile by a HTTP server.
    2) Copy banner images to the same directory containg this file.
    3) Use the HEADER, ECHO or FPASSTHRU (recommended)function to display the banner image in a browser window.
    */

    $dir = exec('pwd');

    $open_dir = opendir("$dir");

    //Add or remove files extensions to suit your needs.
    //Notice that the extensions are in upper and lower case.
    $image_ext_array = array(
    "jpg",
    "jpeg",
    "gif",
    "png",

    "JPG",
    "JPEG",
    "GIF",
    "PNG",
    );

    $image_files = array();

    if(!$open_dir){
    die("can not $dir");
    }
    else{
    while(false !== ($file = readdir($open_dir))){

    $ext = explode(".", "$file");

    if(in_array($ext[1], $image_ext_array)){
    $image = "$ext[0]" . "." . "$ext[1]";
    array_push($image_files, $image);
    }

    }

    //If the PHP server is less that 4.2.0 the SRAND function is needed.
    //srand((float) microtime() * 10000000);
    $show_img = array_rand($image_files);

    //Optional: use the HEADER function to prevent the browser from caching the html content and image.
    //This is most use full when using the HEADER function to display the image
    //header ("Expires: Mon, 26 Jul 1997 05:00:00 GMT");
    //header ("Last-Modified: " . gmdate("D, d M Y H:i:s") . " GMT");
    //header ("Cache-Control: no-cache, no-store, must-revalidate, private, max-age=0, proxy-revalidate, no-transform");
    //header ("Pragma: no-cache");
    //header("Vary: User-Agents");

    //Edit the image ALT field to suit your needs.
    $image_alt = "FreshSoftware 1-866-343-3343";

    $image_location = $dir . "/" . $image_files[$show_img];

    $image_width = getimagesize($image_location);
    $image_height = getimagesize($image_location);

    //USE the ECHO function to display HTML Code.
    //echo "<img src=\"$image_files[$show_img]\" width=\"$image_width[0]\" height=\"$image_height[1]\" alt=\"$image_alt\">";

    //The HEADER function often times fails to rotate an image when refreshing a browser.
    //header("location: http://freshsoftware-internal.net/images/advertisments/freshsoftware/$image_files[$show_img]");

    //Recommended. These three lines make use of the FPASSTHRUE function.
    $open_image = fopen($image_location, 'rb');
    fpassthru($open_image);
    fclose($open_image);

    closedir($open_dir);
    }
    ?>
    DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.

    More Link Farm Code Articles
    More By Codewalkers

     

    IBM® developerWorks developerWorks - FREE Tools!


    NEW! Develop Systems Software Assets with IBM Rational Asset Manager

    Join us for this on demand webcast to learn about developing complex systems more quickly and efficiently. We'll cover market drivers for developing, governing and reusing systems software assets and how you can develop system software assets with Rational Asset Manager.
    FREE! Go There Now!


    NEW! Download IBM Data Studio V1.1

    Visit IBM developerWorks to download the latest trial version of IBM Data Studio V1.1 at no cost. IBM Data Studio is a comprehensive data management solution that helps you effectively design, develop, deploy and manage your data, databases, and database applications throughout the data management life cycle utilizing a consistent and integrated user interface. Unlike other client-side data management solutions that focus on only one aspect of the application lifecycle or database administration, Data Studio complements the Rational Software Delivery platform, providing unparalleled flexibility for a heterogeneous data server environment across platforms.
    FREE! Go There Now!


    NEW! IBM Enterprise Modernization Sandbox for System z

    IBM Enterprise Modernization solutions help organizations evolve core IT systems towards modern architectures and technologies—reducing the burden of maintenance and freeing up resources to develop new business requirements and capabilities. With the IBM Enterprise Modernization Sandbox for System z you can evaluate IBM Enterprise Modernization solutions focused on five key areas: Assets, Architectures, Skills, Processes and Infrastructures, and Investment. Each solution is based upon real customer experiences and offers a proven path to get you started with your modernization projects.
    FREE! Go There Now!


    NEW! IBM Rational ClearCase Innovator's Series

    Learn from the best! Find out how developers use Rational ClearCase to be more flexible, innovative and deliver higher quality code in the Rational ClearCase Power Users eKit. This complimentary eKit provides a collection of materials, like articles, whitepapers, and demos that can help you become a power user of Rational ClearCase.
    FREE! Go There Now!


    NEW! IBM Rational Systems Development e-Kit

    As systems increase in complexity, communication between systems and software teams becomes more and more difficult. Now, there’s a way to improve product quality and communication.<br />Read the “Model Driven Systems Development” white paper to see how. Also included in this kit are more educational white papers, customer examples, tutorials, informative Webcasts, and best practices for designing, building and managing systems.<br />
    FREE! Go There Now!


    NEW! Info 2.0: Harnessing the power of Web 2.0 and Enterprise Mashups

    Listen to this webcast to get an overview of Info 2.0 and a technical demo of how to quickly build an enterprise mashup. IBM's Info 2.0 technology leverages emerging Web 2.0 technologies such as mashups, feeds, AJAX, and JSON in order to simplify assembly of information using feeds and services. Come learn about the technical elements of Info 2.0 including the Feed Generation framework, Mashup Engine, and mashup assembly components. Learn how to pull information from databases, departmental information, and the Web to create mashups critical to your company’s success. We will also discuss best practices to help you get started.
    FREE! Go There Now!


    NEW! Rational Talks to You: Grady Booch on Architecture

    Join this Rational Talks to You teleconference on November 29 at 1:00 pm ET to participate in an interactive discusssion with Grady Booch around architecture and reuse. Get your questions answered!
    FREE! Go There Now!


    NEW! Successful Change and Release Management for .NET

    Join this webcast to discover the key requirements for successful change and release management. Learn how to extend your .NET environment to improve productivity and collaboration, and address core problems afflicting team development. In this webcast, we’ll review typical challenges faced by customers and how to resolve them with the IBM Rational Change and Release Management solution, including Rational ClearCase, Rational ClearQuest and Rational Build Forge. Replay is available for 9 months.
    FREE! Go There Now!


    NEW! Trial download: IBM Rational Functional Tester V7.0.1

    Get a free trial download of the latest version of IBM Rational Functional Tester V7.0.1. Rational Functional Tester is an automated functional and regression testing solution for QA teams concerned with the quality of their Java, Microsoft Visual Studio .NET, and Web-based applications.
    FREE! Go There Now!


    NEW! Webcast: Calling All Testers! Find Application Vulnerabilities Early in the Development Process Where they are Easier to Fix and Less Risky to your Business

    In this webcast, IBM Rational will discuss the importance of Web application security and will share techniques and best practices to introduce application security testing into current QA processes including: understanding common security vulnerabilities and techniques to integrate security testing with defect tracking and remediation systems in an effort to safeguard sensitive online information.
    FREE! Go There Now!



    All FREE IBM® developerWorks Tools!

    LINK FARM CODE ARTICLES

    - FreshSoftware Banner Image Rotater
    - LinkMachine
    - Pagination
    - Ask and Receive version 2.0
    - MyLinks Version 1.1
    - Flexphplink Pro
    - Flexphplink
    - Please remove
    - Simple Outgoing Links/Url Hit Counter
    - PHP-LINKS





    © 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway