TÂCHE: application PhoneGap qui télécharge des photos dans le fichier de sélection.
- J'ai réussi à utiliser Filepicker dans l'application.
- Je réussi à utiliser d'autres Uploader avec l'entrée d'origine: http://blueimp.github.io/jQuery-File-Upload/
- Ce qui n'a pas réussi mais est de télécharger à FilePicker en utilisant natif (pour iOS6) "fichier" type = entrée
<!DOCTYPE html>
<html>
<head>
<title>Filepicker PhoneGap iOS6</title>
</head>
<script type="text/javascript" src="cordova-2.2.0.js"></script>
<script type="text/javascript" src="jquery.min.js"></script>
<script type="text/javascript" src="ChildBrowser.js"></script>
<script type="text/javascript" src="filepicker.js"></script>
<script type="text/javascript">
function useFilepicker() {
/* snippet from: http://stackoverflow.com/questions/13369249/filepicker-io-with-phone-gap-on-ios/14525181#14525181 */
cb = window.plugins.childBrowser;
if(cb!=null){
cb.onLocationChange = function(loc){
if (loc != "about:blank"){
console.log(loc);
if(loc.indexOf("fpurl") > -1) {
cb.close();
}
var n = loc.split("fpurl=");
fpurl = n[1];
alert(fpurl);
}
};
cb.showWebPage("https://www.filepicker.io/dialog/open/?m=image/*&key=______YOUR_KEY_HERE______&referrer=&modal=false&redirect_url=https://www.filepicker.io/dialog/phonegap_done/");
}
}
$(function(){
$("input#file").on("change", function() {
("textarea#base64").val($(this).val());
/* _____WHAT TO PUT HERE_____ */
});
});
</script>
<body>
<h3>function calling Filepicker API</h3>
<a href="#" onClick="useFilepicker(); return false">Use Filepicker</a>
<!-- this works, but user experience suffers - I don't want to open extra window, I would like to have take photo/choose existing -->
<h3>input type="filepicker"</h3>
<input type="filepicker"/>
<!-- Doesn't work, created issue here: https://github.com/Filepicker/filepicker-phonegap/issues/1 -->
<h3>input type="file"</h3>
<form action="_____WHAT TO PUT HERE_____">
<input id="file" type="file"/>
</form>
<textarea id="base64">Here c:/fakepath/image.jpg path with be</textarea>
</body>
</html>
note: ce code utilise le plugin ChildBrowser, vous pouvez suivre ces instructions: https://github.com/alunny/ChildBrowser/issues/28#issuecomment-15941458Comment indiquer à Filepicker de télécharger un fichier à partir d'une entrée native type = "fichier"?
points supplémentaires: comment utiliser la bibliothèque comme - https://gokercebeci.com/dev/canvasresize(plug-in pour le redimensionnement d'image côté client) pour réduire la taille du fichier avant transmiting données en utilisant la connexion 3G fleaky?
Merci d'avance pour toute suggestion et tout soutien.