From b9c830932199d36320255382751a3ac7107d1585 Mon Sep 17 00:00:00 2001 From: zhuzhengjun Date: Thu, 28 Mar 2024 08:51:04 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E8=A3=81=E5=89=AA=E6=8A=A5?= =?UTF-8?q?=E9=94=99=E9=97=AE=E9=A2=98?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: zhuzhengjun --- .../src/main/ets/components/plugin/ImagecropPlugin.ets | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/ohos/imagecrop/src/main/ets/components/plugin/ImagecropPlugin.ets b/ohos/imagecrop/src/main/ets/components/plugin/ImagecropPlugin.ets index 889a5b5..c3a14f4 100644 --- a/ohos/imagecrop/src/main/ets/components/plugin/ImagecropPlugin.ets +++ b/ohos/imagecrop/src/main/ets/components/plugin/ImagecropPlugin.ets @@ -12,7 +12,7 @@ * See the License for the specific language governing permissions and * limitations under the License. */ - + import { FlutterPlugin, FlutterPluginBinding @@ -140,6 +140,7 @@ export default class ImagecropPlugin implements FlutterPlugin, MethodCallHandler await pixelMapData.crop(region); let dstFile = this.createTemporaryImageFilePath(); await this.savaPixelMap(pixelMapData, dstFile); + await imageSource.release(); result.success(dstFile); } @@ -155,15 +156,18 @@ export default class ImagecropPlugin implements FlutterPlugin, MethodCallHandler } let dstFile = this.createTemporaryImageFilePath(); await this.savaPixelMap(pixelMapData, dstFile); - await this.copyExif(path, dstFile); + await imageSource.release() + // await this.copyExif(path, dstFile); //此方法OHOS接口暂时支持有问题 等新版本在验证 result.success(dstFile); } private async getImageOptions(path: string, result: MethodResult) { - let options = await this.decodeImageOptions(image.createImageSource(path)); + let source = image.createImageSource(path); + let options = await this.decodeImageOptions(source); let properties = new HashMap(); properties.set("width", options.getWidth()); properties.set("height", options.getHeight()); + await source.release(); result.success(properties); } -- Gitee