PHP Classes
elePHPant
Icontem

File: setup.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of Marius Zadara  >  ExifSort  >  setup.php  >  Download  
File: setup.php
Role: Auxiliary script
Content type: text/plain
Description: Application setup file
Class: ExifSort
Read EXIF information from picture files
Author: By
Last change:
Date: 7 years ago
Size: 1,818 bytes
 

Contents

Class file image Download
<?php

/**
 * File used to set-up the source and destionation directories.
 * It also checks the status of the EXIF module into the PHP environment.
 * It is included in index.php
 *
 * @author Marius Zadara <marius@zadara.org>
 * @copyright (C) Marius Zadara <marius@zadara.org>
 */

// VERIFY THE EXIF MODULE LOADING STATUS //////////////////////////////////////////////////////////
try
{
   
// instanciate the extensions class
   
$extensions = new Extensions();
   
   
// try to locate/load the EXIF module
    // if failed, the function will throw an ExifNotFound exception
   
$exifLoaded = $extensions->isLoaded("EXIF");

   
// if reached this point, the EXIF module is enabled
    // clean up the memory used so far
   
unset($extensions, $exifLoaded);
}
catch (
ExifNotFound $exNotFound)
{
   
// display the exception
   
echo $exNotFound;
   
   
// clean up the memory
   
unset($exNotFound);
}


// SOURCE DIRECTORY HANDLING //////////////////////////////////////////////////////////////////////
try
{
   
// set the source directory using the constans
   
$srcDirectory = new MyDirectory(Constants::$SOURCE_DIRECTORY);
   
   
// validate the source directory
   
$validDirectory = $srcDirectory->validate(false);
}
catch (
DirectoryException $dirEx)
{
   
// display the exception
   
echo $dirEx;
}

// clear the memory used so far
unset($validDirectory);


// DESTINATION DIRECTORY HANDLING /////////////////////////////////////////////////////////////////
try
{
   
// set the destionation directory
   
$destDirectory = new MyDirectory(Constants::$DESTINATION_DIRECTORY);
   
   
// create the destionation directory
   
$validDirectory = $destDirectory->create();
}
catch(
DirectoryException $dirEx)
{
   
// display the exception
   
echo $dirEx;
}

// clear the memory used
unset($validDirectory);

?>