diff --git a/comicgen.js b/comicgen.js index b4a7bf0..7ddebab 100644 --- a/comicgen.js +++ b/comicgen.js @@ -177,16 +177,25 @@ cg.createTextFromInput = function(e){ pop.play(); } } -cg.createImageFromInput= function(e){ +cg.createImageFromInput= function(t){ - var key = e.keyCode || e.which; - var imgUrl = $('#newImgUrl').val(); + var fileList = t.files; /* now you can work with the file list */ + var imageType = /image.*/; + var nBytes = 0; + + for (var i = 0; i < fileList.length; i++) + { + + var file = fileList[i]; + nBytes += file.size; + if (!file.type.match(imageType)) + { + continue; + } + imgUrl = window.URL.createObjectURL(file); + cg.createImage(imgUrl); + } - if(key == 13){ - - cg.createImage(imgUrl); - $('#newImgUrl').val(''); - } } cg.saveImage = function(){ var data = c.toDataURL('png'); diff --git a/gege.css b/gege.css index 4c9a40b..374f965 100644 --- a/gege.css +++ b/gege.css @@ -248,3 +248,12 @@ text-decoration: underline; width: 70px ; display : inline; } +.upload{ + margin-top: 20px; + margin-bottom: 20px; + +} + +input.file { + display:none; +} diff --git a/index.html b/index.html index cfd0c3c..cdf4615 100644 --- a/index.html +++ b/index.html @@ -1,5 +1,5 @@ - + @@ -70,13 +70,14 @@
-
-
+
+ +

Télécharger une image

+
T
-

Instructions