mirror of
https://github.com/zoriya/Kyoo.git
synced 2025-05-24 02:02:36 -04:00
Fix image resize not working
This commit is contained in:
parent
ab12de8287
commit
93b36f1bd4
@ -77,18 +77,18 @@ namespace Kyoo.Core.Controllers
|
||||
using SKCodec codec = SKCodec.Create(reader);
|
||||
SKImageInfo info = codec.Info;
|
||||
info.ColorType = SKColorType.Rgba8888;
|
||||
SKBitmap bitmap = SKBitmap.Decode(codec, info);
|
||||
using SKBitmap original = SKBitmap.Decode(codec, info);
|
||||
|
||||
bitmap.Resize(new SKSizeI(bitmap.Width, bitmap.Height), SKFilterQuality.High);
|
||||
await _WriteTo(bitmap, $"{localPath}.{ImageQuality.High.ToString().ToLowerInvariant()}.jpg");
|
||||
using SKBitmap high = original.Resize(new SKSizeI(original.Width, original.Height), SKFilterQuality.High);
|
||||
await _WriteTo(high, $"{localPath}.{ImageQuality.High.ToString().ToLowerInvariant()}.jpg");
|
||||
|
||||
bitmap.Resize(new SKSizeI((int)(bitmap.Width / 1.5), (int)(bitmap.Height / 1.5)), SKFilterQuality.Medium);
|
||||
await _WriteTo(bitmap, $"{localPath}.{ImageQuality.Medium.ToString().ToLowerInvariant()}.jpg");
|
||||
using SKBitmap medium = high.Resize(new SKSizeI((int)(high.Width / 1.5), (int)(high.Height / 1.5)), SKFilterQuality.Medium);
|
||||
await _WriteTo(medium, $"{localPath}.{ImageQuality.Medium.ToString().ToLowerInvariant()}.jpg");
|
||||
|
||||
bitmap.Resize(new SKSizeI(bitmap.Width / 2, bitmap.Height / 2), SKFilterQuality.Low);
|
||||
await _WriteTo(bitmap, $"{localPath}.{ImageQuality.Low.ToString().ToLowerInvariant()}.jpg");
|
||||
using SKBitmap low = medium.Resize(new SKSizeI(medium.Width / 2, medium.Height / 2), SKFilterQuality.Low);
|
||||
await _WriteTo(low, $"{localPath}.{ImageQuality.Low.ToString().ToLowerInvariant()}.jpg");
|
||||
|
||||
image.Blurhash = Blurhasher.Encode(bitmap, 4, 3);
|
||||
image.Blurhash = Blurhasher.Encode(low, 4, 3);
|
||||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
|
@ -39,14 +39,14 @@ namespace Kyoo.Postgresql.Migrations
|
||||
FROM shows AS s
|
||||
UNION ALL
|
||||
SELECT
|
||||
m.id, m.slug, m.name, m.tagline, m.aliases, m.overview, m.tags, m.genres, m.status,
|
||||
-m.id, m.slug, m.name, m.tagline, m.aliases, m.overview, m.tags, m.genres, m.status,
|
||||
m.air_date as start_air, m.air_date as end_air, m.poster_source, m.poster_blurhash, m.thumbnail_source,
|
||||
m.thumbnail_blurhash, m.logo_source, m.logo_blurhash, m.trailer, m.external_id, m.air_date, m.path,
|
||||
'movie'::item_kind AS kind
|
||||
FROM movies AS m
|
||||
UNION ALL
|
||||
SELECT
|
||||
c.id, c.slug, c.name, NULL as tagline, NULL as alises, c.overview, NULL AS tags, NULL AS genres, 'unknown'::status AS status,
|
||||
c.id + 10000 AS id, c.slug, c.name, NULL as tagline, NULL as alises, c.overview, NULL AS tags, NULL AS genres, 'unknown'::status AS status,
|
||||
NULL AS start_air, NULL AS end_air, c.poster_source, c.poster_blurhash, c.thumbnail_source,
|
||||
c.thumbnail_blurhash, c.logo_source, c.logo_blurhash, NULL as trailer, c.external_id, NULL AS air_date, NULL as path,
|
||||
'collection'::item_kind AS kind
|
||||
|
Loading…
x
Reference in New Issue
Block a user