Miscellaneous
  Home arrow Miscellaneous arrow Page 2 - Creating an Image Gallery
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? 
MISCELLANEOUS

Creating an Image Gallery
By: notepad
  • Search For More Articles!
  • Disclaimer
  • Author Terms
  • Rating: 5 stars5 stars5 stars5 stars5 stars / 8
    2003-10-24

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

  • 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


    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


       · if your larger images are dead, and you right-click to see the properties of the...
       · ... or#4 - You may not have the gd library properly installed or PHP compiled...
       · At first I was confused as to why TYPE was serialized in config.php only to be...
       · right, it actually says in the tutorial &quot;we'll define an array of valid...
       · *blush* I guess I should have &quot;thoroughly&quot; read through the text...
       · thanks this will help me make my gallery, i already started but this will help me...
       · as i add improvements to this gallery over time, i'll make them available...
       · new bug found that might be causing dead thumbnails.. if the names are odd,...
       · i dunno why i bothered to post that, considering i fixed it, and the post before...
       · Thank you for this great tutorial, it helped my understanding a lot!
       · Thank you for this great tutorial, it helped my understanding a lot!
       · Thank you for this great tutorial, it helped my understanding a lot!
       · alright the old update site has been shutdown. further updates for this gallery...
       · I found that i can't login to this admin panel. The rest of the script works, apart...
       · within your config file, make sure the HOST value is your domain. otherwise it will...
       · if you haven't gotten the updated script from the code library, definately do...
       · Make the thumbs pop up in new window? Some images viewed in full size torture my my...
       · Great tutorial.I am somewhat new to PHP. I managed to get the script working no...
       · Great tutorial.I am somewhat new to PHP. I managed to get the script working no...
       · Hi, im kinda new in PHP, and here is my (must be simple) problem: I putted the hole...
       · so i started over, from scratch. a revised tutorial will be published in phparch.com...
       · adding the revised code to the code section, again. the &quot;new...
       · 
       · error in line &quot;$size = getimagesize($dir.$file);&quot; of...
       · error in line &quot;$size = getimagesize($dir.$file);&quot; of...
       · 
       · 
     

    MISCELLANEOUS ARTICLES

    - Shell Script Writing
    - Loops in the UNIX Shell
    - The Test in the UNIX Shell
    - Data Streams and the UNIX Shell
    - Control Mechanisms of the UNIX Shell
    - Variables Within the UNIX Shell
    - The Shell and UNIX
    - In Detail: UNIX File Systems
    - Rights Management in UNIX
    - UNIX File Systems
    - The Terminal in UNIX
    - Operating Systems and UNIX
    - Fedora 10 Released
    - Stopping CSRF Attacks in Your PHP Applicatio...
    - Quick and Dirty AJAX Tutorial





    © 2003-2009 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway
    Stay green...Green IT