This commit is contained in:
1 parent
e85e4d74ea
commit
2e4ed76121
378 files changed
+22404
-20686
No files matched your search
+9
-16
@@ -5,11 +5,11 @@
|
||||
* Override with NEXT_PUBLIC_IMAGER_URL when needed (e.g. CDN in front).
|
||||
*/
|
||||
|
||||
const IMAGER_URL = process.env.NEXT_PUBLIC_IMAGER_URL || '/api/imaging/avatar'
|
||||
const IMAGER_URL = process.env.NEXT_PUBLIC_IMAGER_URL || "/api/imaging/avatar";
|
||||
|
||||
export type { AvatarOptions } from '@/types/admin'
|
||||
export type { AvatarOptions } from "@/types/admin";
|
||||
|
||||
import type { AvatarOptions } from '@/types/admin'
|
||||
import type { AvatarOptions } from "@/types/admin";
|
||||
|
||||
/**
|
||||
* Build an avatar image URL served by the self-hosted imager.
|
||||
@@ -20,25 +20,18 @@ import type { AvatarOptions } from '@/types/admin'
|
||||
* getAvatarUrl(look, { size: 'm', gesture: 'sml', direction: 2 })
|
||||
*/
|
||||
export function getAvatarUrl(figure: string, options: AvatarOptions = {}): string {
|
||||
const {
|
||||
size = 'm',
|
||||
direction = 2,
|
||||
headDirection = 3,
|
||||
headOnly = false,
|
||||
gesture,
|
||||
action,
|
||||
} = options
|
||||
const { size = "m", direction = 2, headDirection = 3, headOnly = false, gesture, action } = options;
|
||||
|
||||
const params = new URLSearchParams({
|
||||
figure,
|
||||
direction: String(direction),
|
||||
head_direction: String(headDirection),
|
||||
size,
|
||||
})
|
||||
});
|
||||
|
||||
if (headOnly) params.set('headonly', '1')
|
||||
if (gesture) params.set('gesture', gesture)
|
||||
if (action) params.set('action', action)
|
||||
if (headOnly) params.set("headonly", "1");
|
||||
if (gesture) params.set("gesture", gesture);
|
||||
if (action) params.set("action", action);
|
||||
|
||||
return `${IMAGER_URL}?${params.toString()}`
|
||||
return `${IMAGER_URL}?${params.toString()}`;
|
||||
}
|
||||
Reference in new issue
Block a user