mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-11-23 18:01:00 +00:00
parent
747a8f5b96
commit
a670096d53
2 changed files with 13 additions and 1 deletions
3
ui/src/components/post-listing.tsx
vendored
3
ui/src/components/post-listing.tsx
vendored
|
@ -27,6 +27,7 @@ import {
|
||||||
getUnixTime,
|
getUnixTime,
|
||||||
pictshareAvatarThumbnail,
|
pictshareAvatarThumbnail,
|
||||||
showAvatars,
|
showAvatars,
|
||||||
|
imageThumbnailer,
|
||||||
} from '../utils';
|
} from '../utils';
|
||||||
import { i18n } from '../i18next';
|
import { i18n } from '../i18next';
|
||||||
import { T } from 'inferno-i18next';
|
import { T } from 'inferno-i18next';
|
||||||
|
@ -137,7 +138,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||||
>
|
>
|
||||||
<img
|
<img
|
||||||
class="mx-2 mt-1 float-left img-fluid thumbnail rounded"
|
class="mx-2 mt-1 float-left img-fluid thumbnail rounded"
|
||||||
src={post.url}
|
src={imageThumbnailer(post.url)}
|
||||||
/>
|
/>
|
||||||
</span>
|
</span>
|
||||||
)}
|
)}
|
||||||
|
|
11
ui/src/utils.ts
vendored
11
ui/src/utils.ts
vendored
|
@ -352,3 +352,14 @@ export function showAvatars(): boolean {
|
||||||
!UserService.Instance.user
|
!UserService.Instance.user
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// Converts to image thumbnail (only supports pictshare currently)
|
||||||
|
export function imageThumbnailer(url: string): string {
|
||||||
|
let split = url.split('pictshare');
|
||||||
|
if (split.length > 1) {
|
||||||
|
let out = `${split[0]}pictshare/140x140${split[1]}`;
|
||||||
|
return out;
|
||||||
|
} else {
|
||||||
|
return url;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue