AiursoftWeb / Kahla.App

Kahla is a cross-platform business messaging app.
https://www.kahla.app
MIT License
415 stars 85 forks source link

Use the new probe suggested compressor. #647

Closed Anduin2017 closed 5 years ago

Anduin2017 commented 5 years ago

[//]: <Don't delete any header! Please fill out the form or your bug report will not be considered!>

About the new API

About the API feature

The compression algorithm of Probe has been modified. It is now more recommended to use only one parameter to get the compressed image.

For example: specify only w or just h. Then the value of another dimension, Probe itself calculates, and maintains the aspect ratio of the original image.

These changes I am looking forward to can help simplify some of the fucking code in Kahla.App and save an extra parameter.

Kahla can not calculate the width and height of the real picture, but directly specify only one parameter to quickly complete the rendering of the picture.

Example

https://probe.aiursoft.com/Download/InSites/usericon/53de617d093040bab113a6508dbcdd19.png?w=100

In addition: forcing two parameters to be specified will still cause the Probe to compress with the specified target parameters. However, in this case, the parameter passer must be responsible for maintaining the aspect ratio of the image.

xxyzz commented 5 years ago

Unfortunately, this new API will not delete a single line of code. The client needs both width and height of a image to calculate the display size. As you can see from here. I don't think the images part need any simplification(there are just a few lines) unless you let the browser choose the size and compress the image without changing the size.