mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-03 17:59:37 +02:00

Use their own size. In the future we may imagine resizing remote images on demand like classic CDNs
26 lines
742 B
TypeScript
26 lines
742 B
TypeScript
import { CONFIG } from '@server/initializers/config.js'
|
|
import { ActorImageModel } from '@server/models/actor/actor-image.js'
|
|
import { MActorImage } from '@server/types/models/index.js'
|
|
import { AbstractPermanentFileCache } from './shared/index.js'
|
|
|
|
export class AvatarPermanentFileCache extends AbstractPermanentFileCache<MActorImage> {
|
|
|
|
constructor () {
|
|
super(CONFIG.STORAGE.ACTOR_IMAGES_DIR)
|
|
}
|
|
|
|
protected loadModel (filename: string) {
|
|
return ActorImageModel.loadByFilename(filename)
|
|
}
|
|
|
|
protected getImageSize (image: MActorImage): { width: number, height: number } {
|
|
if (image.width && image.height) {
|
|
return {
|
|
height: image.height,
|
|
width: image.width
|
|
}
|
|
}
|
|
|
|
return undefined
|
|
}
|
|
}
|