Skip to content
This repository has been archived by the owner on Oct 29, 2024. It is now read-only.

Thumbnail proportional scaling #70

Open
ElMaxo opened this issue Feb 9, 2021 · 1 comment
Open

Thumbnail proportional scaling #70

ElMaxo opened this issue Feb 9, 2021 · 1 comment

Comments

@ElMaxo
Copy link

ElMaxo commented Feb 9, 2021

Hello
There is no convenient way to create proportionally scaled thumbnails now. We can't get original size thumbnail, because default thumbnail dimensions will be set as 150*150. Also, we can't perform custom processing by manual ffmpeg context creation, because many file types failed to open without mime type specification, but mime type can be specified only at private method.
Please, take a look at https://github.com/ElMaxo/thumbnailer/blob/master/thumbnailer.go#L105. I think this is a good solution. Also, proportional scaling can be added by height, not only by width.

bakape added a commit that referenced this issue Feb 10, 2021
@bakape
Copy link
Owner

bakape commented Feb 10, 2021

There is no convenient way to create proportionally scaled thumbnails now.
https://github.com/ElMaxo/thumbnailer/blob/master/thumbnailer.go#L105

150x150 or anything you set is only the bounding box (I now see the docs are not too clear about this). The actual thumbnail dimensions are calculated here https://github.com/bakape/thumbnailer/blob/master/thumbnailer.c#L327-L335 If I understand correctly, what you need is to only scale by one dimension? That can be easily achieved by setting the dimension you don't want to scale by to a large number like math.MaxUint32.

we can't perform custom processing by manual ffmpeg context creation

What exactly do you need to do?

mime type can be specified only at private method

You can register more functions for MIME type detection with https://pkg.go.dev/github.com/bakape/thumbnailer#RegisterMatcher

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants