Link Farm Code
  Home arrow Link Farm Code arrow FreshSoftware Banner Image Rotater
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  
Mobile Linux 
App Generation ROI 
IBM® developerWorks 
Download TestComplete 
Forums Sitemap 
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
     
     
    ADVERTISEMENT


    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!


    IBM – Taking Web 2.0 to Work

    You'll get answers to many questions and more from David Barnes, Lead Evangelist for IBM Emerging Internet Technologies. David will discuss aspects of Web 2.0 that bring value to corporations, academia, and government. He'll also discuss IBM's vision around Web 2.0, including the importance of remixability and consumability. The discussion will culminate with examples of various IBM Software Group solutions you can use to get ahead of the Web 2.0 adoption curve.
    FREE! Go There Now!


    NEW! Download DB2 9.5 for Linux, Unix, and Windows

    Download a free trial version of IBM DB2 9.5 for Linux, UNIX, and Windows. DB2 9 is the result of a five-year development project that transformed traditional (static) database technology into an interactive data server that merges the high performance and ease of use of DB2 with the self-describing benefits of XML.
    FREE! Go There Now!


    NEW! Download IBM WebSphere Portal V6.1 beta code

    Download the IBM WebSphere Portal V6.1 beta code and learn more about the rich features and enhancements in IBM WebSphere Portal V6.1. WebSphere Portal provides a composite application or business mashup framework and the advanced tooling needed to build flexible, SOA-based solutions, and scalability to meet the needs of any size organization.
    FREE! Go There Now!


    NEW! Evaluate Rational Host Access Transformation Services (HATS) Toolkit V7.1

    Visit IBM developerWorks to download a free trial of the Rational Host Access Transformation Services (HATS) Toolkit. The HATS toolkit provides a set of plug-ins for the IBM Rational Software Delivery Platform to help you easily extend your legacy applications. HATS makes your 3270 and 5250 applications available as HTML through the most popular Web browsers, while converting your host screens to a Web look and feel and it also enables you to develop new Web, portal, and rich-client applications.
    FREE! Go There Now!


    NEW! Evaluate WebSphere Extended Deployment Compute Grid V6.1

    Visit IBM developerWorks to download a free trial version of WebSphere Extended Deployment Compute Grid, which lets you schedule, execute, and monitor batch jobs. Because online transaction processing and batch jobs execute simultaneously on the same server resources, you can avoid costly duplication of resources. Compute Grid supports job types of Java transactional batch, compute-intensive and a new type called "native execution", which enables non-Java workloads to run on distributed end points.
    FREE! Go There Now!


    NEW! Improve your build process with IBM Rational Build Forge, Part 2: Automate builds for a real-world Tomcat project

    Learn how Rational Build Forge can extend a simple compile and package build process by adding customization and deployment capability. Go from a manual method to automating: checking for code changes; getting the latest source; compiling and packaging; customizing; copying to and restarting a deployment server; and sending e-mail notification that a new version is available.
    FREE! Go There Now!


    NEW! Rational Talks to You:Per Kroll on Rational Method Composer Plug-in customization

    Join this Rational Talks to You teleconference on December 11 at 1:00 pm ET to get tips on building your own plugins with Rational Method Composer. 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 Lotus Forms V3.0

    Get a free trial download of IBM Lotus Forms V3.0 (formerly Workplace Forms), which provides a zero-footprint eForms solution to help you automate and move forms-based business processes off the desktop and onto the Web. With Lotus Forms, you can extend applications beyond the firewall by creating a single electronic form document ready for use in both thick and Web 2.0 thin client format.
    FREE! Go There Now!


    NEW! Try the IBM SOA Sandbox for Connectivity

    Visit IBM developerWorks to try the IBM SOA Sandbox for connectivity. The SOA Sandbox for connectivity provides a trial environment with the tooling and components to help you explore how to effectively connect your infrastructure and integrate all of the people, processes and information in your company. Use the hosted sandbox to explore SOA techniques that streamline connecting existing IT assets together, as well as learn how to connect them to new business logic.
    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-2009 by Developer Shed. All rights reserved. DS Cluster 3 Hosted by Hostway
    For more Enterprise Application Development news, visit eWeek