tags(trim($_POST['tags'])); // Check filetype $allowed_types = array('jpg', 'jpeg', 'png', 'webp'); if (!in_array($file_type, $allowed_types)) { ?> Uploaders username {{userid}} -> Uploaders ID {{time}} -> microtime of upload {{date}} -> date of upload {{filename}} -> takes original filename {{autoinc}} -> checks if file with name already exists if so it adds a number on the end of it "foo" -> Text is accepted between templates */ $name_template = $upload_conf['rename_to']; $name_template = str_replace('{{username}}', $_SESSION["username"], $name_template); $name_template = str_replace('{{userid}}', $_SESSION["id"], $name_template); $name_template = str_replace('{{time}}', round(microtime(true)), $name_template); $name_template = str_replace('{{date}}', date("Y-m-d"), $name_template); $name_template = str_replace('{{filename}}', pathinfo($dir.$_FILES['image']['name'],PATHINFO_FILENAME), $name_template); if (str_contains($name_template, "{{autoinc}}")) { $autoinc = 0; $autoinc_tmp_name = str_replace('{{autoinc}}', $autoinc, $name_template).".".$file_type; while (is_file($dir.$autoinc_tmp_name)) { $autoinc += 1; $autoinc_tmp_name = str_replace('{{autoinc}}', $autoinc, $name_template).".".$file_type; } $name_template = str_replace('{{autoinc}}', $autoinc, $name_template); } $image_newname = $name_template.".".$file_type; $image_path = $dir.$image_newname; // Check for conflicting names, as the config could be setup wrong if (is_file($image_path)) { ?> 300) { if ($make_stuff->thumbnail($image_path, $thumb_dir.$image_newname, 300) != "success") { ?> 1100) { if ($make_stuff->thumbnail($image_path, $preview_dir.$image_newname, 900) != "success") { ?>