Adding pictshare image thumbnailer.

- Fixes #377
This commit is contained in:
Dessalines 2020-01-03 14:13:22 -05:00
parent 747a8f5b96
commit a670096d53
2 changed files with 13 additions and 1 deletions

View File

@ -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
View File

@ -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;
}
}