Commit a2d54ab0 authored by 林生雨's avatar 林生雨

commit

parent 21f5511c
......@@ -6,8 +6,18 @@
</component>
<component name="ChangeListManager">
<list default="true" id="5be6bbb5-7d6e-4540-a24f-d2b3bf78b3ba" name="Default Changelist" comment="">
<change afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/Anim.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/preview/AlbumPreviewModel.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/preview/AlbumPreviewPage.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/lib/AlbumModel/Anim.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewModel.dart" afterDir="false" />
<change afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewPage.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.idea/workspace.xml" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/.idea/workspace.xml" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/album/AlbumModel.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/ios/.symlinks/plugins/gengmei_flutter_plugin/example/lib/AlbumModel/page/album/AlbumModel.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" beforeDir="false" afterPath="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" afterDir="false" />
<change beforePath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" beforeDir="false" afterPath="$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m" afterDir="false" />
</list>
<ignored path="$PROJECT_DIR$/.dart_tool/" />
<ignored path="$PROJECT_DIR$/.idea/" />
......@@ -27,11 +37,11 @@
<component name="ExecutionTargetManager" SELECTED_TARGET="AKC0218316000622" />
<component name="FileEditorManager">
<leaf SIDE_TABS_SIZE_LIMIT_KEY="300">
<file pinned="false" current-in-tab="false">
<file pinned="false" current-in-tab="true">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="169">
<caret line="151" column="36" selection-start-line="151" selection-start-column="36" selection-end-line="151" selection-end-column="36" />
<state relative-caret-position="396">
<caret line="369" selection-start-line="369" selection-end-line="369" />
<folding>
<element signature="e#46#66#0" expanded="true" />
</folding>
......@@ -39,6 +49,34 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewPage.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="209">
<caret line="34" column="27" selection-start-line="34" selection-start-column="27" selection-end-line="34" selection-end-column="27" />
<folding>
<element signature="e#45#62#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewModel.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="242">
<caret line="11" selection-start-line="11" selection-end-line="11" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/Anim.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1390" />
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/LiveData.dart">
<provider selected="true" editor-type-id="text-editor" />
......@@ -47,8 +85,8 @@
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="871">
<caret line="118" column="35" selection-start-line="118" selection-start-column="35" selection-end-line="118" selection-end-column="35" />
<state relative-caret-position="172">
<caret line="185" column="32" selection-start-line="185" selection-start-column="32" selection-end-line="185" selection-end-column="32" />
<folding>
<element signature="e#45#62#0" expanded="true" />
</folding>
......@@ -68,7 +106,7 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="true">
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291">
......@@ -101,25 +139,6 @@
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/ios/Classes/GengmeiFlutterPlugin.m">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="12672">
<caret line="597" column="22" selection-start-line="597" selection-start-column="22" selection-end-line="597" selection-end-column="22" />
</state>
</provider>
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/ResultManager.h">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
<file pinned="false" current-in-tab="false">
<entry file="file://$PROJECT_DIR$/ios/Classes/Image/ResultManager.m">
<provider selected="true" editor-type-id="text-editor" />
</entry>
</file>
</leaf>
</component>
<component name="FileTemplateManagerImpl">
......@@ -134,7 +153,6 @@
<find>permissions</find>
<find>_rawPath</find>
<find>VALUE</find>
<find>onTap</find>
<find>albumLive</find>
<find>nativeCamera</find>
<find>native</find>
......@@ -153,6 +171,7 @@
<find>_dirList</find>
<find>_onEvent</find>
<find>paseAlbum</find>
<find>onTap</find>
<find>print</find>
</findStrings>
</component>
......@@ -178,10 +197,12 @@
<option value="$PROJECT_DIR$/lib/SharedPlugin.dart" />
<option value="$PROJECT_DIR$/example/lib/main.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/repository/AlbumRepository.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" />
<option value="$PROJECT_DIR$/lib/ScanImagePlugn.dart" />
<option value="$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewModel.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewPage.dart" />
<option value="$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart" />
</list>
</option>
</component>
......@@ -242,6 +263,15 @@
<item name="page" type="462c0819:PsiDirectoryNode" />
<item name="album" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="gengmei_flutter_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" />
<item name="example" type="462c0819:PsiDirectoryNode" />
<item name="lib" type="462c0819:PsiDirectoryNode" />
<item name="AlbumModel" type="462c0819:PsiDirectoryNode" />
<item name="page" type="462c0819:PsiDirectoryNode" />
<item name="preview" type="462c0819:PsiDirectoryNode" />
</path>
<path>
<item name="gengmei_flutter_plugin" type="b2602c69:ProjectViewProjectNode" />
<item name="gengmei_flutter_plugin" type="462c0819:PsiDirectoryNode" />
......@@ -266,17 +296,18 @@
<property name="dart.analysis.tool.window.force.activate" value="false" />
<property name="editor.config.ad.shown" value="true" />
<property name="io.flutter.reload.alreadyRun" value="true" />
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
<property name="last_opened_file_path" value="$PROJECT_DIR$/example/lib/AlbumModel/page" />
<property name="show.migrate.to.gradle.popup" value="false" />
</component>
<component name="RecentsManager">
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/ios/Classes" />
</key>
<key name="CopyFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/example/lib/AlbumModel/page" />
<recent name="$PROJECT_DIR$/example/lib/AlbumModel" />
<recent name="$PROJECT_DIR$/example/lib" />
</key>
<key name="MoveFile.RECENT_KEYS">
<recent name="$PROJECT_DIR$/ios/Classes" />
</key>
</component>
<component name="RunDashboard">
<option name="ruleStates">
......@@ -307,7 +338,7 @@
<frame x="9" y="23" width="1440" height="811" extended-state="6" />
<editor active="true" />
<layout>
<window_info content_ui="combo" id="Project" order="0" visible="true" weight="0.19742489" />
<window_info active="true" content_ui="combo" id="Project" order="0" visible="true" weight="0.19742489" />
<window_info id="Captures" order="1" side_tool="true" />
<window_info id="Structure" order="2" side_tool="true" />
<window_info id="Image Layers" order="3" />
......@@ -322,7 +353,7 @@
<window_info anchor="bottom" id="Android Profiler" order="3" show_stripe_button="false" />
<window_info anchor="bottom" id="Logcat" order="4" weight="0.4534075" />
<window_info anchor="bottom" id="Debug" order="5" />
<window_info active="true" anchor="bottom" id="Terminal" order="6" visible="true" weight="0.29346314" />
<window_info anchor="bottom" id="Terminal" order="6" visible="true" weight="0.29346314" />
<window_info anchor="bottom" id="Event Log" order="7" side_tool="true" />
<window_info anchor="bottom" id="Flutter Performance" order="8" side_tool="true" />
<window_info anchor="bottom" id="Version Control" order="9" />
......@@ -338,15 +369,6 @@
</layout>
</component>
<component name="editorHistoryManager">
<entry file="file://$PROJECT_DIR$/test/gengmei_flutter_plugin_test.dart" />
<entry file="file://$USER_HOME$/Downloads/flutter/packages/flutter/lib/src/services/message_codecs.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="105">
<caret line="563" column="6" selection-start-line="563" selection-start-column="6" selection-end-line="563" selection-end-column="6" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/android/src/main/kotlin/com/example/gengmei_flutter_plugin/GengmeiFlutterPlugin.kt" />
<entry file="file://$PROJECT_DIR$/example/android/app/src/main/AndroidManifest.xml">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="456">
......@@ -565,42 +587,64 @@
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="169">
<caret line="151" column="36" selection-start-line="151" selection-start-column="36" selection-end-line="151" selection-end-column="36" />
<state relative-caret-position="325">
<caret line="49" selection-start-line="49" selection-end-line="52" selection-end-column="3" />
<folding>
<element signature="e#46#66#0" expanded="true" />
<element signature="e#45#86#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291">
<caret line="29" column="35" selection-start-line="29" selection-start-column="21" selection-end-line="29" selection-end-column="35" />
<folding>
<element signature="e#0#20#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/Anim.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="-1390" />
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewModel.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="242">
<caret line="11" selection-start-line="11" selection-end-line="11" />
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumPage.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="871">
<caret line="118" column="35" selection-start-line="118" selection-start-column="35" selection-end-line="118" selection-end-column="35" />
<state relative-caret-position="172">
<caret line="185" column="32" selection-start-line="185" selection-start-column="32" selection-end-line="185" selection-end-column="32" />
<folding>
<element signature="e#45#62#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/ScanImagePlugn.dart">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/preview/AlbumPreviewPage.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="325">
<caret line="49" selection-start-line="49" selection-end-line="52" selection-end-column="3" />
<state relative-caret-position="209">
<caret line="34" column="27" selection-start-line="34" selection-start-column="27" selection-end-line="34" selection-end-column="27" />
<folding>
<element signature="e#45#86#0" expanded="true" />
<element signature="e#45#62#0" expanded="true" />
</folding>
</state>
</provider>
</entry>
<entry file="file://$PROJECT_DIR$/lib/gengmei_flutter_plugin.dart">
<entry file="file://$PROJECT_DIR$/example/lib/AlbumModel/page/album/AlbumModel.dart">
<provider selected="true" editor-type-id="text-editor">
<state relative-caret-position="291">
<caret line="29" column="35" selection-start-line="29" selection-start-column="21" selection-end-line="29" selection-end-column="35" />
<state relative-caret-position="396">
<caret line="369" selection-start-line="369" selection-end-line="369" />
<folding>
<element signature="e#0#20#0" expanded="true" />
<element signature="e#46#66#0" expanded="true" />
</folding>
</state>
</provider>
......
/*
* @author lsy
* @date 2019-10-14
**/
import 'package:flutter/material.dart';
enum RouteWay {
SCARE,
TRAN_RIGHT_TO_LEFT,
ALP,
}
class CustomRoute extends PageRouteBuilder {
final Widget widget;
RouteWay routeWay;
CustomRoute(this.widget, {RouteWay routeWay = RouteWay.TRAN_RIGHT_TO_LEFT})
: super(
// 设置过度时间
transitionDuration: Duration(milliseconds: 230),
// 构造器
pageBuilder: (
// 上下文和动画
BuildContext context,
Animation<double> animaton1,
Animation<double> animaton2,
) {
return widget;
},
transitionsBuilder: (
BuildContext context,
Animation<double> animaton1,
Animation<double> animaton2,
Widget child,
) {
// 渐变效果
if (routeWay.index == 2) {
return FadeTransition(
// 从0开始到1
opacity: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(
// 传入设置的动画
parent: animaton1,
// 设置效果,快进漫出 这里有很多内置的效果
curve: Curves.fastOutSlowIn,
)),
child: child,
);
} else if (routeWay.index == 1) {
return SlideTransition(
position: Tween<Offset>(
begin: Offset(1.0, 0.0), end: Offset(0.0, 0.0))
.animate(CurvedAnimation(
parent: animaton1, curve: Curves.fastOutSlowIn)),
child: child,
);
} else {
return ScaleTransition(
scale: Tween(begin: 0.0, end: 1.0).animate(CurvedAnimation(
parent: animaton1, curve: Curves.fastOutSlowIn)),
child: child,
);
}
// 旋转加缩放动画效果
// return RotationTransition(
// turns: Tween(begin: 0.0,end: 1.0)
// .animate(CurvedAnimation(
// parent: animaton1,
// curve: Curves.fastOutSlowIn,
// )),
// child: ScaleTransition(
// scale: Tween(begin: 0.0,end: 1.0)
// .animate(CurvedAnimation(
// parent: animaton1,
// curve: Curves.fastOutSlowIn
// )),
// child: child,
// ),
// );
});
}
......@@ -12,8 +12,11 @@ import 'package:gengmei_flutter_plugin/ScanImagePlugn.dart';
import 'package:gengmei_flutter_plugin/gengmei_flutter_plugin.dart';
import 'package:gengmei_flutter_plugin_example/AlbumModel/LiveData.dart';
import 'package:gengmei_flutter_plugin_example/AlbumModel/bean/DirBean.dart';
import 'package:gengmei_flutter_plugin_example/AlbumModel/page/preview/AlbumPreviewPage.dart';
import 'package:gengmei_flutter_plugin_example/AlbumModel/repository/AlbumRepository.dart';
import '../../Anim.dart';
const String MainDir = "IsGengmeiAlbumAllImages";
const String MainDirExplain = "全部相片";
......@@ -344,4 +347,38 @@ class AlbumModel {
showPop = false;
albumLive.notifyView(_mainValue[dirName]);
}
bool previewItemClick = false;
void previewItem(BuildContext context, int index, String pageName) {
String path;
if (Platform.isAndroid) {
path = albumLive.data[index].realPath;
Navigator.push(context, CustomRoute(AlbumPreviewPage(path, pageName)));
} else {
// Navigator.push(
// context, CustomRoute(AlbumPreviewPage(albumLive.data[index].path, pageName)));
if (previewItemClick) {
return;
}
previewItemClick = true;
path = albumLive.data[index].path;
iosItem(path, context, (value) {
var realPath = value["realImagePath"];
Navigator.push(
context, CustomRoute(AlbumPreviewPage(realPath, pageName)));
});
}
}
void iosItem(String path, BuildContext context, Function fun) {
GengmeiFlutterPlugin.ios_album_item(path).then((value) {
if (value != null) {
fun(Map<String, String>.from(value));
}
previewItemClick=false;
}).catchError((error) {
previewItemClick=false;
print(error);
});
}
}
......@@ -182,7 +182,10 @@ class AlbumState extends State<AlbumPage> {
return Container();
}
return GestureDetector(
onTap: () => _model.clickItem(context, newIndex),
onTap: (){
_model.previewItem(context, newIndex, "pageName");
// _model.clickItem(context, newIndex);
},
child: Container(
decoration: BoxDecoration(
image: DecorationImage(
......
/*
* @author lsy
* @date 2019-11-01
**/
class AlbumPreviewModel {
final String imgPath;
AlbumPreviewModel(this.imgPath);
}
\ No newline at end of file
/*
* @author lsy
* @date 2019-11-01
**/
import 'dart:io';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:gengmei_flutter_plugin_example/AlbumModel/page/preview/AlbumPreviewModel.dart';
class AlbumPreviewPage extends StatefulWidget {
AlbumPreviewModel _model;
String fromPage;
AlbumPreviewPage(String imgPath, this.fromPage) {
_model = AlbumPreviewModel(imgPath);
}
@override
State<StatefulWidget> createState() => AlbumPreviewState(_model, fromPage);
}
class AlbumPreviewState extends State<AlbumPreviewPage> {
AlbumPreviewModel _model;
final String fromPage;
AlbumPreviewState(this._model, this.fromPage);
@override
Widget build(BuildContext context) {
return Scaffold(
appBar: AppBar(
title: Text("test"),
),
body: ConstrainedBox(
constraints: BoxConstraints.expand(),
child: new Image.file(
File(
_model.imgPath,
),
fit: BoxFit.fitWidth,
)),
);
}
@override
String pageName() {
return "album_preview";
}
@override
String referrer() {
return fromPage;
}
}
......@@ -44,6 +44,7 @@ NSString *cacheDirectory;
assetCollectionList = [NSMutableArray array];
viewController =[UIApplication sharedApplication].delegate.window.rootViewController;
concurrentQueue = dispatch_queue_create("com.gengmei_flutter_plugin", DISPATCH_QUEUE_CONCURRENT);
// concurrentQueue=dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_HIGH, 0);
queue = dispatch_queue_create("com.gengmei_flutter_plugin", DISPATCH_QUEUE_SERIAL);
FlutterEventChannel* chargingChannel = [FlutterEventChannel
eventChannelWithName:@"gengmei_flutter_plugin_event"
......@@ -295,6 +296,7 @@ NSString *cacheDirectory;
// }
//
// CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize);
dispatch_async(concurrentQueue, ^{
[[PHImageManager defaultManager] requestImageDataForAsset:assets options:imageRequestOption resultHandler:^(NSData * _Nullable imageData, NSString * _Nullable dataUTI, UIImageOrientation orientation, NSDictionary * _Nullable info) {
// [[PHImageManager defaultManager] requestImageForAsset:assets targetSize:temp contentMode:PHImageContentModeDefault options:imageRequestOption resultHandler:^(UIImage * _Nullable res, NSDictionary * _Nullable info) {
......@@ -320,6 +322,7 @@ NSString *cacheDirectory;
}
});
}];
});
}
}
}else if ([[self.takePhotoMap allKeys] containsObject:path[i]]){
......@@ -350,7 +353,7 @@ NSString *cacheDirectory;
PHImageRequestOptions *imageRequestOption = [[PHImageRequestOptions alloc] init];
imageRequestOption.synchronous =NO;
imageRequestOption.networkAccessAllowed = YES;
imageRequestOption.deliveryMode=PHImageRequestOptionsDeliveryModeHighQualityFormat;
// imageRequestOption.deliveryMode=PHImageRequestOptionsDeliveryModeFastFormat;
imageRequestOption.resizeMode=PHImageRequestOptionsResizeModeFast;
imageRequestOption.version=PHImageRequestOptionsVersionUnadjusted;
NSString *tempPath = NSTemporaryDirectory();
......@@ -364,6 +367,8 @@ NSString *cacheDirectory;
[dict setObject:tempTake forKey:@"realImagePath"];
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :dict];
}else{
dispatch_async(queue, ^{
CFAbsoluteTime start=CFAbsoluteTimeGetCurrent();
int picWidth=[assets pixelWidth];
int picHeight=[assets pixelHeight];
float tempScareSize=1;
......@@ -373,18 +378,27 @@ NSString *cacheDirectory;
tempScareSize=limit/max;
}
CGSize temp=CGSizeMake(picWidth*tempScareSize, picHeight*tempScareSize);
__block bool isResult=false;
[[PHImageManager defaultManager] requestImageForAsset:assets targetSize:temp contentMode:PHImageContentModeDefault options:imageRequestOption resultHandler:^(UIImage * _Nullable result, NSDictionary * _Nullable info) {
if(isResult){
return ;
}
isResult=true;
@autoreleasepool{
NSData *data = UIImageJPEGRepresentation(result, 1) ;
NSData *data = UIImageJPEGRepresentation(result, 0.7) ;
[data writeToFile:tempTake atomically:YES];
result=nil;
data=nil;
// result=nil;
// data=nil;
}
NSMutableDictionary *dict=[[NSMutableDictionary alloc] init];
[dict setObject:path forKey:@"path"];
[dict setObject:tempTake forKey:@"realImagePath"];
dispatch_async(dispatch_get_main_queue(), ^{
NSLog(@"压缩预览图片耗时:%f ms",(CFAbsoluteTimeGetCurrent()-start)*1000);
[[ResultManager sharedSingleton] resultSuccess:[NSNumber numberWithLong:resultTemp] :dict];
});
}];
});
}
}else if ([[self.takePhotoMap allKeys] containsObject:path]){
NSMutableDictionary *dict=[[NSMutableDictionary alloc] init];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment