File tree 2 files changed +9
-15
lines changed
2 files changed +9
-15
lines changed Original file line number Diff line number Diff line change 9
9
< body >
10
10
< h1 > Pigeon Logger</ h1 >
11
11
< button class ="take-photo "> Take Photo</ button >
12
+ < img id ="image "> </ img >
12
13
13
14
< script type ="text/javascript " src ="phonegap.js "> </ script >
14
15
< script type ="text/javascript " src ="lib/app.js "> </ script >
Original file line number Diff line number Diff line change @@ -7,22 +7,15 @@ class PigeonLogger
7
7
# alert "deviceready"
8
8
9
9
capturePhoto : ->
10
- # capture callback
11
- captureSuccess = (mediaFiles ) ->
12
- navigator .notification .alert " Total files: #{ mediaFiles .length } "
13
- for i in [0 ... mediaFiles .length ]
14
- img = document .createElement ' img'
15
- img .src = mediaFiles[i].fullPath
16
- document .body .appendChild img
10
+ onSuccess = (imageData ) ->
11
+ image = document .getElementById (" image" )
12
+ image .src = " data:image/jpeg;base64," + imageData
13
+ onFail = (message ) ->
14
+ alert " Failed because: " + message
15
+ navigator .camera .getPicture onSuccess, onFail,
16
+ quality : 50
17
+ destinationType : Camera .DestinationType .DATA_URL
17
18
18
- # capture error callback
19
- captureError = (error ) ->
20
- navigator .notification .alert " Error code: " + error .code , null , " Capture Error"
21
-
22
-
23
- # start image capture
24
- navigator .device .capture .captureImage captureSuccess, captureError,
25
- limit : 2
26
19
27
20
28
21
window .app = new PigeonLogger ()
You can’t perform that action at this time.
0 commit comments