@react-native-ohos/react-native-image-crop-picker 0.40.4 → 0.40.5-rc.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
+
## v0.40.5-rc.1
|
|
4
|
+
- Fix the issue where the file size after compression is larger than the original file.
|
|
5
|
+
|
|
3
6
|
## v0.40.4-rc.1
|
|
4
7
|
- react-native-image-crop-picker仓库迁移 ([e09dff16cc4c51bfdcec842921d3c30d49d39a19](https://gitee.com/openharmony-sig/rntpc_react-native-image-crop-picker/pulls/1))
|
|
5
8
|
- chore: add COMMITTERS.md ([6e71f31b17e5aba5a60215b58ddc6f656def74f9](https://gitee.com/openharmony-sig/rntpc_react-native-image-crop-picker/pulls/2))
|
|
@@ -823,30 +823,37 @@ export class ImageCropPickerTurboModule extends TurboModule implements ImageCrop
|
|
|
823
823
|
async getFileInfo(includeBase64: boolean, filePath: string, compressOrTempFilePath: string, exifInfo: Exif): Promise<VideoImageInfo> {
|
|
824
824
|
let videoImageInfo: VideoImageInfo = { duration: null };
|
|
825
825
|
let imageType;
|
|
826
|
-
|
|
827
|
-
|
|
828
|
-
|
|
826
|
+
|
|
827
|
+
const targetFilePath = !this.isNullOrUndefined(compressOrTempFilePath) ? compressOrTempFilePath : filePath;
|
|
828
|
+
|
|
829
|
+
let i = targetFilePath.lastIndexOf('/');
|
|
830
|
+
let fileName = targetFilePath.substring(i + 1);
|
|
831
|
+
i = targetFilePath.lastIndexOf('.');
|
|
829
832
|
if (i != -1) {
|
|
830
|
-
imageType =
|
|
833
|
+
imageType = targetFilePath.substring(i + 1);
|
|
831
834
|
}
|
|
832
|
-
|
|
835
|
+
|
|
836
|
+
videoImageInfo.path = filePrefix + targetFilePath;
|
|
833
837
|
videoImageInfo.filename = fileName;
|
|
834
838
|
videoImageInfo.mime = 'image/' + imageType;
|
|
835
839
|
|
|
836
|
-
let file = fs.openSync(
|
|
840
|
+
let file = fs.openSync(targetFilePath, fs.OpenMode.READ_ONLY)
|
|
837
841
|
let stat = fs.statSync(file.fd);
|
|
838
842
|
let length = stat.size;
|
|
839
843
|
videoImageInfo.size = length;
|
|
840
844
|
videoImageInfo.creationDate = stat.ctime;
|
|
841
845
|
videoImageInfo.modificationDate = stat.mtime;
|
|
842
|
-
|
|
846
|
+
|
|
847
|
+
if (this.isImage(targetFilePath)) {
|
|
843
848
|
let imageIS = image.createImageSource(file.fd)
|
|
844
849
|
let imagePM = await imageIS.createPixelMap()
|
|
845
850
|
let imgInfo = await imagePM.getImageInfo();
|
|
846
|
-
|
|
851
|
+
|
|
852
|
+
videoImageInfo.data = includeBase64 ? this.imageToBase64(targetFilePath) : null;
|
|
847
853
|
videoImageInfo.height = imgInfo.size.height;
|
|
848
854
|
videoImageInfo.width = imgInfo.size.width;
|
|
849
855
|
videoImageInfo.exif = exifInfo;
|
|
856
|
+
|
|
850
857
|
imagePM.release().then(() => {
|
|
851
858
|
imagePM = undefined;
|
|
852
859
|
})
|
|
Binary file
|