banner v2
This commit is contained in:
@@ -140,7 +140,7 @@ export const handleBannerUpload = async (req, res) => {
|
||||
// NOTE: [0] frame selector must be appended to the input path, not a separate arg
|
||||
console.log('[BANNER HANDLER] Running magick...');
|
||||
try {
|
||||
await execFile('magick', [`${tmpPath}[0]`, '-resize', '1200x400^', '-gravity', 'center', '-background', 'none', '-extent', '1200x400', '-quality', '75', finalPath]);
|
||||
await execFile('magick', [`${tmpPath}[0]`, '-resize', '3840x3840>', '-quality', '85', finalPath]);
|
||||
} catch (err) {
|
||||
console.error('[BANNER HANDLER] Magick error:', err.message, err.stderr);
|
||||
await fs.unlink(tmpPath).catch(() => { });
|
||||
@@ -172,7 +172,9 @@ export const handleBannerUpload = async (req, res) => {
|
||||
try {
|
||||
await db`
|
||||
update user_options
|
||||
set banner_file = ${finalFilename}
|
||||
set banner_file = ${finalFilename},
|
||||
banner_position = ${parts.banner_position || 'center'},
|
||||
banner_size = ${parts.banner_size || 'cover'}
|
||||
where user_id = ${+req.session.id}
|
||||
`;
|
||||
} catch (dbErr) {
|
||||
|
||||
@@ -535,6 +535,8 @@ export default {
|
||||
uo.avatar as author_avatar,
|
||||
uo.avatar_file as author_avatar_file,
|
||||
uo.banner_file as author_banner_file,
|
||||
uo.banner_position as author_banner_position,
|
||||
uo.banner_size as author_banner_size,
|
||||
uo.description as author_description,
|
||||
author_u.id as author_id,
|
||||
items.is_pinned,
|
||||
@@ -796,6 +798,8 @@ export default {
|
||||
author_avatar: actitem.author_avatar,
|
||||
author_avatar_file: actitem.author_avatar_file,
|
||||
author_banner_file: actitem.author_banner_file,
|
||||
author_banner_position: actitem.author_banner_position,
|
||||
author_banner_size: actitem.author_banner_size,
|
||||
author_description: actitem.author_description,
|
||||
title: actitem.title || null,
|
||||
|
||||
|
||||
@@ -47,6 +47,8 @@ export default (router, tpl) => {
|
||||
excluded_tags: excluded_tags || [],
|
||||
avatar_file: userOptions?.avatar_file || null,
|
||||
banner_file: userOptions?.banner_file || null,
|
||||
banner_position: userOptions?.banner_position || 'center',
|
||||
banner_size: userOptions?.banner_size || 'cover',
|
||||
email: user?.email || '',
|
||||
joined: user?.created_at || null,
|
||||
user_banner_enabled: cfg.websrv.user_banner_enabled !== false,
|
||||
|
||||
Reference in New Issue
Block a user