From 8c0c91b52efdc9b6cca1bce301891732ad489dc0 Mon Sep 17 00:00:00 2001 From: atomaka Date: Fri, 11 Nov 2011 00:42:59 -0500 Subject: [PATCH] Throwaway import script. Currently only testing to see how many images will be lost in transition. --- import.php | 115 +++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 115 insertions(+) create mode 100644 import.php diff --git a/import.php b/import.php new file mode 100644 index 0000000..31bb2e3 --- /dev/null +++ b/import.php @@ -0,0 +1,115 @@ + $upload, + ); + if(preg_match('/^([0-9]+)(\..*)/', $upload, $matches) == 0) { + $current['error'] = 'File is not in screens format'; + $imports[] = $current; + $failed++; + continue; + } + + $id = $matches[1]; + $extension = $matches[2]; + $size = getimagesize($upload_dir . $upload); + $width = $size[0]; + $height = $size[1]; + $file_size = filesize($upload_dir . $upload) / 1024; + $hash = md5_file($upload_dir . $upload); + $duplicate = check_duplicate($hash); + + if($file_size > 2048) { + $current['error'] = 'File size exceeds 2048kb'; + $imports[] = $current; + $failed++; + continue; + } + if(preg_match('/(gif|jpg|jpeg|png|bmp)/',$upload) == 0) { + $current['error'] = 'File extension not supported'; + $imports[] = $current; + $failed++; + continue; + } + if($duplicate) { + $current['error'] = 'File is a duplicate: ' . $id; + $imports[] = $current; + $failed++; + continue; + } + + $current['height'] = $height; + $current['width'] = $width; + $current['file_size'] = $file_size; + $current['hash'] = $hash; + $current['extension'] = $extension; + + $imports[] = $current; +} + +function check_duplicate($hash) { + // code incoming + return false; +} +?> + +Total Imports: ( failed)
+
+ + + + + + + + + + + + + + + + + + + + + +
File NameDimensionsFile SizeHashExtension
+ + xkb
+
\ No newline at end of file