aboutsummaryrefslogtreecommitdiffstats
path: root/admin/include/functions.php
diff options
context:
space:
mode:
Diffstat (limited to 'admin/include/functions.php')
-rw-r--r--admin/include/functions.php53
1 files changed, 52 insertions, 1 deletions
diff --git a/admin/include/functions.php b/admin/include/functions.php
index 0207bd9b8..ecab3782f 100644
--- a/admin/include/functions.php
+++ b/admin/include/functions.php
@@ -53,7 +53,58 @@ function is_image( $filename, $create_thumbnail = false )
}
return false;
}
-
+
+/**
+ * returns an array with all picture files according to $conf['picture_ext']
+ *
+ * @param string $dir
+ * @return array
+ */
+function get_picture_files( $dir )
+{
+ global $conf;
+
+ $pictures = array();
+ if ( $opendir = opendir( $dir ) )
+ {
+ while ( $file = readdir( $opendir ) )
+ {
+ if ( in_array( get_extension( $file ), $conf['picture_ext'] ) )
+ {
+ array_push( $pictures, $file );
+ }
+ }
+ }
+ return $pictures;
+}
+
+/**
+ * returns an array with all thumbnails according to $conf['picture_ext']
+ * and $conf['prefix_thumbnail']
+ *
+ * @param string $dir
+ * @return array
+ */
+function get_thumb_files( $dir )
+{
+ global $conf;
+
+ $prefix_length = strlen( $conf['prefix_thumbnail'] );
+
+ $thumbnails = array();
+ if ( $opendir = @opendir( $dir ) )
+ {
+ while ( $file = readdir( $opendir ) )
+ {
+ if ( in_array( get_extension( $file ), $conf['picture_ext'] )
+ and substr($file,0,$prefix_length) == $conf['prefix_thumbnail'] )
+ {
+ array_push( $thumbnails, $file );
+ }
+ }
+ }
+ return $thumbnails;
+}
function TN_exists( $dir, $file )
{