### 拍照获取图片 mag.camera(config); ``` /** * @param(required) config Object * { * preview: 成功后回调 (Function, required) * success: 拍照成功后回调 (Function, required) * fail: 拍照失败后回调 (Function, required) * } */ mag.camera({ preview: function(res){ // res: {key: '图片唯一标识', data: '图片地址'} }, success: function(res){ // res: {aid: '图片id', key: '图片唯一标识'},根据aid获取图片url方法请看下面说明 }, fail: function(res){ // res: {key: '图片唯一标识'} }, }); ``` ### 预览图片 mag.previewImage(config); ~~~ /** * @param(required) config Object *{ * current:0, (Number, required,点击图片的索引) * pics:["图片地址1","图片地址2"] (Array, required) *} */ mag.previewImage({ current: 0, pics: ['picurl1', 'picurl2'] }); ~~~ ###从相册选取图片 mag.picPick(config); ``` /** * @param(required) config Object * { * preview:成功后回调 (Function, required) * success:上传成功后回调 (Function, required) * fail:上传失败后回调 (Function, required) * } */ mag.picPick({ preview: function(res){ // res: {key: '图片唯一标识', data: '图片地址'} }, success: function(res){ // res: {aid: '图片id', key: '图片唯一标识'} }, fail: function(res){ // res: {key: '图片唯一标识'} }, }); ``` ### 根据aid访问图片 ``` http://{app域名}/core/attachment/attachment/attach?aid={aid}&width=80&height=60 app域名: 例如 app.lxh.magcloud.cc aid:上传成功返回的图片id, width,height 可根据显示需要设置图片大小,不提供则为原图 ```