質問するログイン新規登録

質問編集履歴

2

タグの追加

2018/11/05 08:06

投稿

haniwaoshi
haniwaoshi

スコア17

title CHANGED
File without changes
body CHANGED
File without changes

1

コードの追加

2018/11/05 08:06

投稿

haniwaoshi
haniwaoshi

スコア17

title CHANGED
File without changes
body CHANGED
@@ -65,6 +65,65 @@
65
65
  };
66
66
 
67
67
 
68
+ function onFail(){
69
+ console.log("写真を取得できませんでした")
70
+ }
71
+
72
+ $(document).on('pageinit', '#main-page', function(){
73
+ var onSuccess = function(pictureUrl){
74
+ images = [];
75
+ var $img = $('<img>');
76
+ $img.attr('src', pictureUrl);
77
+ images.push({
78
+ element: $img,
79
+ label: '無加工'
80
+ });
81
+ myNavi.pushPage('image.html');
82
+ }
83
+ $(this).on('click', ',take-from-camera', function(){
84
+ getPictureFromCamera(onSuccess);
85
+ });
86
+ $(this).on('click', ',take-from-gallery', function(){
87
+ getPictureFromGallery(onSuccess);
88
+ });
89
+ });
90
+ </script>
91
+ </head>
92
+ <body>
93
+ <ons-navigator var="myNavi">画面の切り替え
94
+ <ons-page id="main-page">
95
+ <ons-toolbar>
96
+ <div class="center">画像変換アプリ</div>
97
+ </ons-toolbar>
98
+ <br>
99
+ <ons-list>
100
+ <ons-list-item modifier="chevron" class="take-from-gallery">
101
+ <ons-icon icon="ion-images"></ons-icon>ギャラリーから選ぶ
102
+ </ons-list-item>
103
+ <ons-list-item modifier="chevron" class="take-from-camera">
104
+ <ons-icon icon="ion-camera"></ons-icon>カメラで撮影
105
+ </ons-list-item>
106
+ </ons-list>
107
+ <br>
108
+ </ons-page>
109
+ </ons-navigator>
110
+
111
+ <ons-template id="image.html">
112
+ <ons-page id="image-page">
113
+ <ons-toolbar>
114
+ <div class="left">
115
+ <ons-back-button ons-if-platform="ios">Back</ons-back-button>
116
+ </div>
117
+ <div class="center">画像</div>
118
+ </ons-toolbar>
119
+ <ons-carousel var="imageCarousel" class="image-carousel" fullscreen auto-scroll overscrollable>
120
+ </ons-carousel>
121
+ </ons-page>
122
+ </ons-template>
123
+ </body>
124
+ </html>
125
+
126
+
68
127
 
69
128
  ```
70
129