database driven image uploader and storage service model
This commit is contained in:
1 parent
76894061c5
commit
3b61a131c1
31 files changed
+433
-149
No files matched your search
@@ -42,3 +42,16 @@ export const appConfigInitProvider = {
|
||||
export function getAppConfig(): AppConfig {
|
||||
return _appConfig;
|
||||
}
|
||||
|
||||
/** Resolve an image URL for rendering.
|
||||
* - Absolute HTTP(S) URLs are returned as-is.
|
||||
* - Static SVG assets (svg/…) are served by the Angular build — returned as-is.
|
||||
* - API paths (/api/storage/…) and legacy paths (uploads/…) are prefixed with apiBaseUrl.
|
||||
*/
|
||||
export function resolveImageUrl(url: string): string {
|
||||
if (!url) return '';
|
||||
if (url.startsWith('http://') || url.startsWith('https://')) return url;
|
||||
if (url.startsWith('svg/')) return url;
|
||||
if (url.startsWith('/')) return `${getAppConfig().apiBaseUrl}${url}`;
|
||||
return `${getAppConfig().apiBaseUrl}/${url}`;
|
||||
}
|
||||
Reference in new issue
Block a user