fix(web/image_hosting): hash suffix
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Baoshuo Ren 2022-11-04 16:51:49 +08:00
parent ca85ba3982
commit 20cecd34a2
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A

View File

@ -51,7 +51,7 @@
} }
list($width, $height, $type) = $size; list($width, $height, $type) = $size;
$hash = hash_file("sha256", $_FILES['image_upload_file']['tmp_name']); $hash = hash_file("sha256", $_FILES['image_upload_file']['tmp_name']) . Auth::id();
$scale = ceil($height / 600.0); $scale = ceil($height / 600.0);
$watermark_text = UOJConfig::$data['profile']['oj-name-short']; $watermark_text = UOJConfig::$data['profile']['oj-name-short'];
@ -60,7 +60,7 @@
$hash .= "__no_watermark"; $hash .= "__no_watermark";
} elseif ($_POST['watermark'] == 'site_shortname_and_username') { } elseif ($_POST['watermark'] == 'site_shortname_and_username') {
$watermark_text .= ' @'.Auth::id(); $watermark_text .= ' @'.Auth::id();
$hash .= "__id_".Auth::id(); $hash .= "__id";
} }
$existing_image = DB::selectFirst("SELECT * FROM users_images WHERE `hash` = '$hash'"); $existing_image = DB::selectFirst("SELECT * FROM users_images WHERE `hash` = '$hash'");