mirror of
https://gitee.com/openharmony/applications_photos
synced 2024-11-27 09:12:32 +00:00
commit
26885dba8d
@ -154,17 +154,17 @@ export abstract class BrowserDataImpl implements BrowserDataInterface {
|
||||
return object;
|
||||
}
|
||||
|
||||
getThumbnailSafe(sourceUri: string, path: string, modifiedDate?: number, size?): string {
|
||||
getThumbnailSafe(sourceUri: string, path: string, size?): string {
|
||||
try {
|
||||
if (size) {
|
||||
if (size.width != 0 && size.height != 0) {
|
||||
return `${sourceUri}?timestampApp=${modifiedDate}&oper=thumbnail&width=${size.width}&height=${size.height}&path=${path}`;
|
||||
return `${sourceUri}?oper=thumbnail&width=${size.width}&height=${size.height}&path=${path}`;
|
||||
} else {
|
||||
Log.warn(TAG, 'getThumbnailSafe with width==0 and height==0, so do not use thumbnail' + JSON.stringify(size));
|
||||
return `${sourceUri}`;
|
||||
}
|
||||
} else {
|
||||
return `${sourceUri}?timestampApp=${modifiedDate}&oper=thumbnail&width=${BrowserDataImpl.THUMBNAIL_WIDTH}&height=${BrowserDataImpl.THUMBNAIL_WIDTH}&path=${path}`;
|
||||
return `${sourceUri}?oper=thumbnail&width=${BrowserDataImpl.THUMBNAIL_WIDTH}&height=${BrowserDataImpl.THUMBNAIL_WIDTH}&path=${path}`;
|
||||
}
|
||||
} catch (err) {
|
||||
Log.warn(TAG, `get Thumbnail Failed! msg:${err}`);
|
||||
|
@ -56,7 +56,7 @@ export class PhotoDataImpl extends BrowserDataImpl {
|
||||
for (let item of dataList) {
|
||||
try {
|
||||
let mediaItem: MediaItem = new MediaItem(item);
|
||||
mediaItem.setThumbnail(this.getThumbnailSafe(mediaItem.uri, mediaItem.path, mediaItem.getDateModified()));
|
||||
mediaItem.setThumbnail(this.getThumbnailSafe(mediaItem.uri, mediaItem.path));
|
||||
mediaItemList.push(mediaItem);
|
||||
} catch (err) {
|
||||
Log.error(TAG, `getMediaItem error: ${err}`);
|
||||
@ -105,7 +105,7 @@ export class PhotoDataImpl extends BrowserDataImpl {
|
||||
try {
|
||||
this.getItemByUri(uri).then((result): void => {
|
||||
let mediaItem: MediaItem = new MediaItem(result);
|
||||
mediaItem.setThumbnail(this.getThumbnail(mediaItem.uri, mediaItem.path, mediaItem.getDateModified()));
|
||||
mediaItem.setThumbnail(this.getThumbnail(mediaItem.uri, mediaItem.path));
|
||||
callback.callback(mediaItem);
|
||||
});
|
||||
} catch (error) {
|
||||
@ -113,8 +113,8 @@ export class PhotoDataImpl extends BrowserDataImpl {
|
||||
}
|
||||
}
|
||||
|
||||
getThumbnail(sourceUri: string, path: string, modifiedDate?: number, size?): string {
|
||||
return this.getThumbnailSafe(sourceUri, path, modifiedDate, size);
|
||||
getThumbnail(sourceUri: string, path: string, size?): string {
|
||||
return this.getThumbnailSafe(sourceUri, path, size);
|
||||
}
|
||||
|
||||
async getDataByName(name: string, albumUri: string): Promise<FileAsset> {
|
||||
|
Loading…
Reference in New Issue
Block a user