!536 【master】图库-图片放大显示

Merge pull request !536 from liujuan/master
This commit is contained in:
openharmony_ci 2024-03-08 02:53:40 +00:00 committed by Gitee
commit 26885dba8d
No known key found for this signature in database
GPG Key ID: 173E9B9CA92EEF8F
2 changed files with 7 additions and 7 deletions

View File

@ -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}`);

View File

@ -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> {