File Manipulation Code

  Home arrow File Manipulation Code arrow Directory image view, with selective h...
FILE MANIPULATION CODE

Directory image view, with selective hidden
By: Codewalkers
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 3 stars3 stars3 stars3 stars3 stars / 6
    2005-06-20

    Table of Contents:

     
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement
    This code lets you display the images in a directory; limiting size - with option to display filesize - and filename.

    It also lets you selective ignore files by name.

    (may be a little sloppy, but its all mine)

    By : Kender

    <?

    /* ************************************
    ** James Wheeler
    ** Kender Internet Kompany
    ** http://kender.org
    **
    ** Name as index.php
    ** - Display all images in a directory
    ** - Able to skip files at will
    ** - remove <img src= and use for
    ** all files in directory
    ** (skipping desired files)
    **
    ** Code free to use, please give credit
    ** where credit is due!
    ************************************ */

    echo '<center>
    Click on a thumbnail to view image<br />
    <table>
    <tr>
    ';

    $main = ".";
    $dir = opendir($main); // unbutton it
    $i = 1; // for column count

    while($filename = readdir($dir))
    {
    {
    if (filetype($filename) == "file" && $filename != "index.php")
    // dont show index.php (this file) - skip any file you dont want viewed
    // format as ( && $filename != "filename.ext" ) inside the () behind "index.php"
    {
    if ($i <= '5') // column count (designed for 5 columns wide - change the 5 for however many wanted)
    {
    $i = $i + '1';
    echo ' <td align="left" width="115" height="100">
    <a href="'.$filename.'"><img src="'.$filename.'" height="60" border="0" /></a><br />
    <font size="1" face="tahoma">'.$filename.'<br />'.filesize($filename).' bytes.</font>
    </td>
    '; // display it
    } else {
    $i = '1'; // reset column count and change rows
    echo ' </tr>
    <tr>
    ';
    $i = $i + '1'; // add 1 to counter to get to next row
    echo ' <td align="left" width="115" height="100">
    <a href="'.$filename.'"><img src="'.$filename.'" height="60" border="0" /></a><br />
    <font size="1" face="tahoma">'.$filename.'<br />'.filesize($filename).' bytes.</font>
    </td>
    '; // display it
    }
    }
    }
    }

    closedir($dir); // button it up

    echo '
    </tr>
    </table>
    </center>
    ';

    exit;
    ?>
    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 File Manipulation Code Articles
    More By Codewalkers

    blog comments powered by Disqus

    FILE MANIPULATION CODE ARTICLES

    - Bandwidth Control with pure PHP
    - Eazy Gallery
    - file_get_contents for PHP < 4.3.0
    - PHP Class: Image Snapshot 1.3
    - Universal downloader
    - Image Gallery v2.0
    - Free/Used Disk Space
    - Directory Lister
    - Directory image view, with selective hidden
    - Move or Copy a Directory (and files and sub ...
    - Ensure_Sub_Directory_Exists
    - Wedit
    - Form Examples Text Boxes to Drop Downs
    - myFiles
    - List files in a directory, no subdirectories

    Developer Shed Affiliates

     



    © 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap