diff --git a/app/image/upload_image.php b/app/image/upload_image.php
index c0a2551..135826e 100644
--- a/app/image/upload_image.php
+++ b/app/image/upload_image.php
@@ -16,10 +16,10 @@ if (isset($_POST['submit'])) {
$dir = "../../images/";
$thumb_dir = $dir."thumbnails/";
- // File paths
- $image_basename = basename($_FILES['image']['name']);
- $image_path = $dir.$image_basename;
- $file_type = pathinfo($image_path,PATHINFO_EXTENSION);
+ // File name updating
+ $file_type = pathinfo($dir.$_FILES['image']['name'],PATHINFO_EXTENSION);
+ $image_newname = "IMG_".$_SESSION["username"]."_".round(microtime(true)).".".$file_type;
+ $image_path = $dir.$image_newname;
// Allowed file types
$allowed_types = array('jpg', 'jpeg', 'png', 'webp');
@@ -30,11 +30,11 @@ if (isset($_POST['submit'])) {
try {
$image_thumbnail = new Imagick($image_path);
$image_thumbnail->resizeImage(300,null,null,1,null);
- $image_thumbnail->writeImage($thumb_dir.$image_basename);
+ $image_thumbnail->writeImage($thumb_dir.$image_newname);
} catch (Exception $e) {
?>
assets/icons/file-search.svg');
+ sniffleAdd('Gwha!', 'Pls provide image', 'var(--red)', 'assets/icons/file-search.svg');
}
});
});
@@ -58,7 +58,7 @@
if (!loggedin()) {
echo "
";
}