Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { Card } from '$lib/components/index.js';
import { humanFileSize } from '$lib/helpers/sizeConvertion';
import { formatTimeDetailed } from '$lib/helpers/timeConversion';
import type { Models } from '@appwrite.io/console';
import { ImageFormat, type Models } from '@appwrite.io/console';
import { page } from '$app/state';
import {
Badge,
Expand Down Expand Up @@ -46,7 +46,23 @@
}

function getFilePreview(fileId: string) {
return sdk.forConsoleIn(page.params.region).storage.getFileView('screenshots', fileId);
return sdk
.forConsoleIn(page.params.region)
.storage.getFilePreview(
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's also set resolutions for image, something reasonable. See what size image has on big screen, and double that (for retina displays). such size should be enough to have all details.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you have macos with retina, double-check if it looks blurry or detailed. You can also ask me if you want to double check. If it looks blurry, let's stay at source resolution - not override it

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't worry too much about the resolutions. a fixed, all in one, should be fine if we use a correct image format type. I expect previews should be cached as well. a mid range resolution should be just fine.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Update the resolution to 1024 x 576 (looks good, imo).

'screenshots',
fileId,
1024,
576,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
ImageFormat.Webp
);
}
</script>

Expand Down
20 changes: 18 additions & 2 deletions src/routes/(console)/project-[region]-[project]/sites/grid.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
import { base } from '$app/paths';
import { page } from '$app/state';
import { timeFromNow } from '$lib/helpers/date';
import type { Models } from '@appwrite.io/console';
import { ImageFormat, type Models } from '@appwrite.io/console';
import { Card, Icon, Layout, Popover, Tooltip, Typography } from '@appwrite.io/pink-svelte';
import { generateSiteDeploymentDesc } from './store';
import { SvgIcon } from '$lib/components';
Expand Down Expand Up @@ -33,7 +33,23 @@
}

function getFilePreview(fileId: string) {
return sdk.forConsoleIn(page.params.region).storage.getFileView('screenshots', fileId);
return sdk
.forConsoleIn(page.params.region)
.storage.getFilePreview(
'screenshots',
fileId,
1024,
576,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
undefined,
ImageFormat.Webp
);
}
</script>

Expand Down