Add blog thumbnail and banner upload endpoints with storage keys.
Store image filenames in DB, resolve paths for cleanup on replace/delete, and reuse product-thumb multer limits.
This commit is contained in:
@@ -31,6 +31,20 @@ export const variantImagesUrlPrefix = '/uploads/public/variants/images/';
|
||||
|
||||
export const getVariantImagePublicUrl = (filename: string): string => `${variantImagesUrlPrefix}${filename}`;
|
||||
|
||||
export const getBlogImagesDir = (): string => join(getPublicUploadsDir(), 'blog', 'images');
|
||||
|
||||
export const blogImagesUrlPrefix = '/uploads/public/blog/images/';
|
||||
|
||||
export const getBlogImagePublicUrl = (filename: string): string => `${blogImagesUrlPrefix}${filename}`;
|
||||
|
||||
export const resolveBlogImagePath = (storageKey: string): string => {
|
||||
const baseDir = getBlogImagesDir();
|
||||
|
||||
const absolutePath = resolvePathWithinDir(baseDir, storageKey);
|
||||
|
||||
return absolutePath;
|
||||
};
|
||||
|
||||
export const getShopBrandingDir = (): string => join(getPublicUploadsDir(), 'shop');
|
||||
|
||||
export const shopBrandingUrlPrefix = '/uploads/public/shop/';
|
||||
|
||||
Reference in New Issue
Block a user