Skip to content
Open
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
2 changes: 1 addition & 1 deletion src/shared/components/common/media-uploads.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ export class MediaUploads extends Component<Props, never> {
<div className={cols}>
<PictrsImage
src={buildImageUrl(i.local_image.pictrs_alias)}
type="full_size"
type="large_thumbnail"
/>
</div>
<div className={cols}>{this.deleteImageBtn(i.local_image)}</div>
Expand Down
9 changes: 8 additions & 1 deletion src/shared/components/common/pictrs-image.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const defaultImgSize = 512;
const bannerSize = 2048;

type PictrsImageType =
| "full_size"
| "large_thumbnail"
| "thumbnail"
| "icon"
| "banner"
Expand Down Expand Up @@ -195,9 +195,16 @@ export function buildPictrsSrc(src: string, type: PictrsImageType): string {
url.searchParams.set("max_size", thumbnailSize.toString());
break;
case "icon":
case "icon_without_banner":
url.searchParams.set("max_size", iconThumbnailSize.toString());
break;
case "banner":
case "icon_and_banner":
case "card_top":
url.searchParams.set("max_size", bannerSize.toString());
break;
case "large_thumbnail":
// Use bannerSize here for slight downscaling, but larger than thumbnail
url.searchParams.set("max_size", bannerSize.toString());
break;
Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Noticed a bug here, in large card mode it was always loading images downscaled to 512px because it was entering the default case here. Also added other variants where it seems to make sense.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Hrm... not sure about this one. 512px seems plenty large enough, and we def want to downscale no matter, even for the card views, to save on initial page load bandwidth. These images could be 10MB or more, we don't know.

The only time we shouldn't be downscaling IMO, is for the full image viewer.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Okay changed the name to large_thumbnail and set it to 2048px.

default:
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/post/post-listing-card.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -349,7 +349,7 @@ function PostImg({
<div className="my-2">
<PictrsImage
src={imageSrc}
type="full_size"
type="large_thumbnail"
alt={post.alt_text}
imageDetails={postView.image_details}
nsfw={postView.post.nsfw || postView.community.nsfw}
Expand Down
2 changes: 1 addition & 1 deletion src/shared/components/post/post-listings.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -225,6 +225,6 @@ function postListingModeCols(mode: PostListingMode): string {
return "col-12";
case "card":
case "small_card":
return "col-12 col-md-6";
return "col-12 col-xl-6";
}
}