mirror of
https://github.com/LemmyNet/lemmy.git
synced 2024-10-01 01:36:12 -04:00
parent
747a8f5b96
commit
a670096d53
3
ui/src/components/post-listing.tsx
vendored
3
ui/src/components/post-listing.tsx
vendored
@ -27,6 +27,7 @@ import {
|
||||
getUnixTime,
|
||||
pictshareAvatarThumbnail,
|
||||
showAvatars,
|
||||
imageThumbnailer,
|
||||
} from '../utils';
|
||||
import { i18n } from '../i18next';
|
||||
import { T } from 'inferno-i18next';
|
||||
@ -137,7 +138,7 @@ export class PostListing extends Component<PostListingProps, PostListingState> {
|
||||
>
|
||||
<img
|
||||
class="mx-2 mt-1 float-left img-fluid thumbnail rounded"
|
||||
src={post.url}
|
||||
src={imageThumbnailer(post.url)}
|
||||
/>
|
||||
</span>
|
||||
)}
|
||||
|
11
ui/src/utils.ts
vendored
11
ui/src/utils.ts
vendored
@ -352,3 +352,14 @@ export function showAvatars(): boolean {
|
||||
!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 New Issue
Block a user