1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00
pigallery2/frontend/app/gallery/grid/GridPhoto.ts
2016-05-12 11:01:08 +02:00

18 lines
777 B
TypeScript

import {Photo} from "../../../../common/entities/Photo";
import {Config} from "../../config/Config";
import {Utils} from "../../../../common/Utils";
export class GridPhoto {
constructor(public photo:Photo, public renderWidth:number, public renderHeight:number) {
}
getThumbnailPath() {
let renderSize = Math.sqrt(this.renderWidth * this.renderHeight);
let size = Utils.findClosest(renderSize, Config.Client.thumbnailSizes);
return Utils.concatUrls("/api/gallery/content/", this.photo.directory.path, this.photo.directory.name, this.photo.name, "thumbnail", size.toString());
}
getPhotoPath() {
return Utils.concatUrls("/api/gallery/content/", this.photo.directory.path, this.photo.directory.name, this.photo.name);
}
}