File size: 572 Bytes
1e92f2d
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
// @flow
import type { DBCommunity } from 'shared/types';
import { signImageUrl } from 'shared/imgix';

// prettier-ignore
export const signCommunity = (community: DBCommunity, expires?: number): DBCommunity => {
  const { profilePhoto, coverPhoto, ...rest } = community;

  return {
    ...rest,
    profilePhoto: signImageUrl(profilePhoto, { 
      w: 256, 
      h: 256, 
      dpr: 2, 
      auto: 'compress',
      expires 
    }),
    coverPhoto: signImageUrl(coverPhoto, { 
      w: 1280, 
      h: 384, 
      dpr: 2, 
      q: 100,
      expires 
    }),
  };
};