Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Added readme.

  • Loading branch information...
commit 66a4defbd84b0369d02849501bc0e6e61301c680 1 parent ad685ea
@indranil authored
Showing with 36 additions and 8 deletions.
  1. +13 −0 README.textile
  2. +23 −8 index.php
View
13 README.textile
@@ -0,0 +1,13 @@
+h1.Itsy Bitsy Gallery
+
+h3.What does it do?
+
+It displays all the image files within a folder as a gallery.
+
+h3. Configurations?
+
+None! Put the file in the folder, and see magic unfold!
+
+h4. Requirements?
+
+Images. PHP.
View
31 index.php
@@ -11,17 +11,32 @@
* @package default
**/
-if(version_compare(PHP_VERSION,'5','<'))
- die('Sorry, we require PHP 5+ to properly function!');
+if(version_compare(PHP_VERSION,'5','<')) die('Sorry, we require PHP 5+ to properly function!');
// Let's see where we are.
-define('PATH', @realpath(dirname('__FILE__')));
-
-if($dir_handle = scandir(PATH)) {
- echo '<pre>';
- print_r($dir_handle);
- echo '</pre>';
+$path = @realpath(dirname('__FILE__'));
+
+$types = array('image/bmp','image/gif','image/x-icon','image/jpeg','image/pjpeg','image/x-jps','image/x-portable-bitmap','image/x-pict','image/x-pcx','image/pict','image/png','image/tiff','image/x-tiff');
+
+$files = array();
+
+// We're scanning the directory now
+if($dir_handle = @scandir($path)) {
+ $i = 0;
+ foreach($dir_handle as $file) {
+ $flag = 0;
+ echo mime_content_type($file);
+ for($j=0;$j<count($types);$j++) {
+ if($file === $type[$j]) {
+ $flag = 1;
+ }
+ }
+ if($flag === 0) {
+ $files[$i] = $file;
+ $i++;
+ }
+ }
Please sign in to comment.
Something went wrong with that request. Please try again.