{/if}
diff --git a/src/lib/components/lemmy/post/helpers.ts b/src/lib/components/lemmy/post/helpers.ts
index 54954dd2..793f0065 100644
--- a/src/lib/components/lemmy/post/helpers.ts
+++ b/src/lib/components/lemmy/post/helpers.ts
@@ -1,7 +1,26 @@
-import type { CommentView, PersonView, PostView } from 'lemmy-js-client'
+import { getInstance } from '$lib/lemmy.js'
+import type { CommentView, PersonView, Post, PostView } from 'lemmy-js-client'
export const isMutable = (post: PostView, me: PersonView) =>
(me.person.admin && post.post.local) || me.person.id == post.creator.id
export const isCommentMutable = (comment: CommentView, me: PersonView) =>
me.person.id == comment.creator.id
+
+export const bestImageURL = (
+ post: Post,
+ compact: boolean = true,
+ width: number = 1024
+) => {
+ if (compact && post.thumbnail_url)
+ return `${post.thumbnail_url}?thumbnail=256&format=webp`
+ else if (compact && post.url) return `${post.url}?thumbnail=256&format=webp`
+
+ if (post.url) return `${post.url}?thumbnail=${width}&format=webp`
+ else if (post.thumbnail_url)
+ return `${post.thumbnail_url}?thumbnail=${width}&format=webp`
+
+ return post.url ?? ''
+}
+
+export const postLink = (post: Post) => `/post/${getInstance()}/${post.id}`
diff --git a/src/lib/components/ui/ExpandableImage.svelte b/src/lib/components/ui/ExpandableImage.svelte
new file mode 100644
index 00000000..20edf9eb
--- /dev/null
+++ b/src/lib/components/ui/ExpandableImage.svelte
@@ -0,0 +1,49 @@
+
+
+