Public site: the Site design logo is the favicon
A 300x300 thumbnail of it (PocketBase's existing media thumb size), also as the phone home-screen icon. Without a logo the bundled icon stays. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01Hy2vMnHJYP7QGsiH21zHxW
This commit is contained in:
parent
72f8898925
commit
d3d8910c3c
2 changed files with 18 additions and 1 deletions
|
|
@ -20,3 +20,14 @@ export function createPocketBase(authCookie?: string, url = pbUrl) {
|
|||
export function getFileUrl(collectionIdOrName: string, recordId: string, filename: string) {
|
||||
return `${pbUrl}/api/files/${collectionIdOrName}/${recordId}/${filename}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* A small version of an uploaded image: PocketBase makes thumbnails of media
|
||||
* files in the sizes listed on the field (`media.file` has 300x300, cropped
|
||||
* to fill). Other URLs (and SVGs, which PocketBase doesn't resize) are
|
||||
* returned as they are.
|
||||
*/
|
||||
export function thumbUrl(url: string, size: '300x300' | '1200x0' = '300x300') {
|
||||
if (!url.includes('/api/files/') || /\.svg(\?|$)/i.test(url)) return url;
|
||||
return `${url}${url.includes('?') ? '&' : '?'}thumb=${size}`;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue