fix(web/image_hosting): watermark hash suffix

This commit is contained in:
Baoshuo Ren 2022-10-13 20:23:34 +08:00
parent 8ec306e09d
commit e41832cca7
Signed by: baoshuo
GPG Key ID: 00CB9680AB29F51A
3 changed files with 4 additions and 4 deletions

View File

@ -844,7 +844,7 @@ CREATE TABLE `users_images` (
`height` int(11) NOT NULL, `height` int(11) NOT NULL,
`upload_time` datetime NOT NULL, `upload_time` datetime NOT NULL,
`size` int(11) NOT NULL, `size` int(11) NOT NULL,
`hash` varchar(70) NOT NULL, `hash` varchar(100) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `uploader` (`uploader`), KEY `uploader` (`uploader`),
KEY `path` (`path`), KEY `path` (`path`),

View File

@ -58,10 +58,10 @@
$watermark_text = UOJConfig::$data['profile']['oj-name-short']; $watermark_text = UOJConfig::$data['profile']['oj-name-short'];
if (isSuperUser($myUser) && $_POST['watermark'] == 'no_watermark') { if (isSuperUser($myUser) && $_POST['watermark'] == 'no_watermark') {
$watermark_text = ""; $watermark_text = "";
$hash .= "__no"; $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"; $hash .= "__id_".Auth::id();
} }
$existing_image = DB::selectFirst("SELECT * FROM users_images WHERE `hash` = '$hash'"); $existing_image = DB::selectFirst("SELECT * FROM users_images WHERE `hash` = '$hash'");

View File

@ -14,7 +14,7 @@ CREATE TABLE `users_images` (
`height` int(11) NOT NULL, `height` int(11) NOT NULL,
`upload_time` datetime NOT NULL, `upload_time` datetime NOT NULL,
`size` int(11) NOT NULL, `size` int(11) NOT NULL,
`hash` varchar(70) NOT NULL, `hash` varchar(100) NOT NULL,
PRIMARY KEY (`id`), PRIMARY KEY (`id`),
KEY `uploader` (`uploader`), KEY `uploader` (`uploader`),
KEY `path` (`path`), KEY `path` (`path`),