Miscellaneous

  Home arrow Miscellaneous arrow Page 2 - Creating an Image Gallery
MISCELLANEOUS

Creating an Image Gallery
By: notepad
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 4 stars4 stars4 stars4 stars4 stars / 13
    2003-10-24

    Table of Contents:
  • Creating an Image Gallery
  • getting started
  • moving along
  • review and organize
  • thumbnails
  • conclusion

  •  
     

    SEARCH CODEWALKERS

    TOOLS YOU CAN USE

    advertisement

    Creating an Image Gallery - getting started


    (Page 2 of 6 )

    in order to get started, we'll need the most important information contained in a configuration file. this should be information that we're able to change, but not information that will change dynamically. for example, we'll need to know the directory we'll be working with:

    <?php
    // main images directory
    define('PATH''/inetpub/wwwroot/scripts/gallery/images/');
    ?>

    sometimes FTP programs automatically add log files to the directories you navigate, not to mention that we may want index files in each directory to make sure users aren't surfing places they shouldn't be. whatever the case may be, we need to make sure our script is only working with images. in order to acheive this, we'll define an array of valid MIME types; we'll have to serialize it because the define() function only works with scalar values.

    <?php
    // valid MIME types, all other files will be ignored
    define('TYPE'serialize(array('image/jpg''image/jpeg''image/pjpeg')));
    ?>

    considering that we'll display our galleries in an HTML table, the easiest way to determin how many images to display at a time is to define how many rows and columns we want to work with.

    <?php
    // how many rows of images to display per page
    define('ROWS'3);

    // how many columns of images to display per page
    define('COLS'5);
    ?>

    then of course we'll need to know what our thumbnail demensions are.

    <?php
    // maximum thumbnail width
    define('THMBWIDTH'100);

    // maximum thumbnail height
    define('THMBHEIGHT'100);
    ?>

    and that's it, our first script (config.php) is complete.

    More Miscellaneous Articles
    More By notepad

    blog comments powered by Disqus

    MISCELLANEOUS ARTICLES

    - Oracle Database XE: Indexes and Sequences
    - Modifying Tables in Oracle Database XE
    - Oracle Database XE: Tables and Constraints
    - More on Oracle Databases and Datatypes
    - Oracle Database XE Datatypes: Datetime and L...
    - Oracle Database XE Datatypes: Character and ...
    - From Databases to Datatypes
    - Firefox 3.6.6 Released with Improved Plug-in...
    - Attention Bloggers: WordPress 3.0 Now Releas...
    - Reflection in PHP 5
    - Inheritance and Other Advanced OOP Features
    - Advanced OOP Features
    - Linux from Scratch V.6.6 Review
    - Linux Gaining in Strength
    - Install Slackware on Your Old PC


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