1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

improving bestfit photo

This commit is contained in:
Patrik J. Braun 2019-12-23 12:09:41 +01:00
parent 9e7e66a4aa
commit 5bb17294ec
4 changed files with 6 additions and 7 deletions

View File

@ -23,10 +23,12 @@ export class PhotoConverterMWs {
return next();
}
if (Config.Server.Media.Photo.Converting.onTheFly) {
if (Config.Server.Media.Photo.Converting.onTheFly === true) {
req.resultPipe = await PhotoProcessing.convertPhoto(fullMediaPath,
Config.Server.Media.Photo.Converting.resolution);
return next();
}
// not converted and won't be now
return res.redirect(req.originalUrl.slice(0, -1 * '\\bestFit'.length));
}

View File

@ -185,7 +185,7 @@ export class ImageRendererFactory {
const sharp = require('sharp');
sharp.cache(false);
return async (input: RendererInput): Promise<void> => {
Logger.silly('[SharpThRenderer] rendering thumbnail:' + input.mediaPath);
Logger.silly('[SharpRenderer] rendering photo:' + input.mediaPath + ', size:' + input.size);
const image: Sharp = sharp(input.mediaPath, {failOnError: false});
const metadata: Metadata = await image.metadata();

View File

@ -40,10 +40,7 @@ export class MediaIcon {
}
getBestFitMediaPath() {
return Utils.concatUrls(Config.Client.urlBase,
'/api/gallery/content/',
this.media.directory.path, this.media.directory.name, this.media.name,
'/bestFit');
return Utils.concatUrls(this.getMediaPath(), '/bestFit');
}

View File

@ -29,7 +29,7 @@ export class GalleryLightboxMediaComponent implements OnChanges {
thumbnailSrc: string = null;
photo = {
src: <string>null,
isBestFit: false
isBestFit: <boolean>null
};
public transcodeNeedVideos = SupportedFormats.TranscodeNeed.Videos;
private mediaLoaded = false;