forked from nutomic/lemmy
parent
07d7664a38
commit
912871d0ac
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,
|
||||
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 a new issue