mirror of
https://github.com/Chocobozzz/PeerTube.git
synced 2025-10-04 18:29:27 +02:00
server/server -> server/core
This commit is contained in:
parent
114327d4ce
commit
5a3d0650c9
838 changed files with 111 additions and 111 deletions
27
server/core/lib/files-cache/avatar-permanent-file-cache.ts
Normal file
27
server/core/lib/files-cache/avatar-permanent-file-cache.ts
Normal file
|
@ -0,0 +1,27 @@
|
|||
import { CONFIG } from '@server/initializers/config.js'
|
||||
import { ACTOR_IMAGES_SIZE } from '@server/initializers/constants.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.loadByName(filename)
|
||||
}
|
||||
|
||||
protected getImageSize (image: MActorImage): { width: number, height: number } {
|
||||
if (image.width && image.height) {
|
||||
return {
|
||||
height: image.height,
|
||||
width: image.width
|
||||
}
|
||||
}
|
||||
|
||||
return ACTOR_IMAGES_SIZE[image.type][0]
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue