Rewrite media caching (old image provider)
- Doesn't use pyotherside's image provider feature, for more flexibility and simplicity - Suitable for supporting matrix media events and more later - Avoid a lot of duplicate files that the old cache created due to server not returning what we expect, mistakes in Python/QML code, etc - Changed file structure (e.g. thumbnails/32x32/<mxc id> instead of thumbnails/<mxc id>.32.32.crop) - Backend.wait_until_account_exist: start issuing warnings if the function runs for more than 10s, which means in most case a bad user ID was passed - New HMxcImage QML component, used in H(User/Room)Avatar
This commit is contained in:
@@ -154,25 +154,6 @@ function filterModelSource(source, filter_text, property="filter_string") {
|
||||
}
|
||||
|
||||
|
||||
function thumbnailParametersFor(width, height) {
|
||||
// https://matrix.org/docs/spec/client_server/latest#thumbnails
|
||||
|
||||
if (width > 640 || height > 480)
|
||||
return {width: 800, height: 600, fillMode: Image.PreserveAspectFit}
|
||||
|
||||
if (width > 320 || height > 240)
|
||||
return {width: 640, height: 480, fillMode: Image.PreserveAspectFit}
|
||||
|
||||
if (width > 96 || height > 96)
|
||||
return {width: 320, height: 240, fillMode: Image.PreserveAspectFit}
|
||||
|
||||
if (width > 32 || height > 32)
|
||||
return {width: 96, height: 96, fillMode: Image.PreserveAspectCrop}
|
||||
|
||||
return {width: 32, height: 32, fillMode: Image.PreserveAspectCrop}
|
||||
}
|
||||
|
||||
|
||||
function fitSize(width, height, max) {
|
||||
if (width >= height) {
|
||||
let new_width = Math.min(width, max)
|
||||
|
||||
Reference in New Issue
Block a user