$file, 'date' => filemtime($path.$file)); } closedir($dir_handle); foreach($files as $file) { if (image_in_dir($file['name'], $images)) continue; add_db_image($dirid, '', '', '', $file['name'], $file['date']); } $count = get_dir_count($dirpath); update_dir_count($dirpath, $count); function image_in_dir($path, $images) { foreach($images as $image) { if ($image['path'] == $path) return true; } return false; } ?>DONE