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.
Next: moving along >>
More Miscellaneous Articles
More By notepad
|
| · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | · | | | | |
|