mirror of
https://github.com/Jellify-Music/App.git
synced 2026-02-21 11:18:52 -06:00
plz
This commit is contained in:
@@ -15,7 +15,7 @@ export function fetchItemImage(itemId: string, imageType: ImageType = ImageType.
|
||||
const existingImage = await FileSystem.exists(getImageFilePath(itemId, width, height, imageType));
|
||||
|
||||
if (existingImage)
|
||||
resolve(await FileSystem.readFile(getImageFilePath(itemId, width, height, imageType)));
|
||||
resolve(await FileSystem.readFile(getImageFilePath(itemId, width, height, imageType), 'base64'));
|
||||
else
|
||||
getImageApi(Client.api!)
|
||||
.getItemImage({
|
||||
@@ -35,7 +35,7 @@ export function fetchItemImage(itemId: string, imageType: ImageType = ImageType.
|
||||
|
||||
FileSystem.writeFile(getImageFilePath(itemId, width, height, imageType), await blobToBase64(data))
|
||||
.then(async () => {
|
||||
resolve(await FileSystem.readFile(getImageFilePath(itemId, width, height, imageType)));
|
||||
resolve(await FileSystem.readFile(getImageFilePath(itemId, width, height, imageType), 'base64'));
|
||||
})
|
||||
} else {
|
||||
reject();
|
||||
@@ -47,8 +47,8 @@ export function fetchItemImage(itemId: string, imageType: ImageType = ImageType.
|
||||
});
|
||||
}
|
||||
|
||||
function getImageFilePath(itemId: string, width: number, height: number, imageType?: ImageType | undefined) {
|
||||
return `${Dirs.CacheDir}/images/${itemId}_${imageType ? `${imageType}_` : ''}${width}x${height}.Jpg`
|
||||
function getImageFilePath(itemId: string, width: number, height: number, imageType: ImageType) {
|
||||
return `${Dirs.CacheDir}/images/${itemId}_${imageType}_${width}x${height}.Jpg`
|
||||
}
|
||||
|
||||
function blobToBase64(blob : Blob) {
|
||||
|
||||
Reference in New Issue
Block a user