javascript - Lapton image converting to jpeg on fly -


i compressing jpeg images .lep, have .exe file convert .lep image jpeg, want write simple jsp can decode , .lep image on fly , show on browser , below code working on ie only

<html> <head> <script type="text/javascript">      function foo() {         console.log("testing");         var wshshell = new activexobject("wscript.shell");         var oexec = wshshell.exec("d:\lepton.exe d:\img.lep");          var stroutput = oexec.stdout.readall();         console.log(stroutput);          document.getelementbyid("img1").src = "d:\img.jpg";     }  </script>  </head>  <body>         <button onclick="foo()">click me</button>         <img id="img1" alt="smiley face" >  </body>  </html> 

activex controls work internet explorer, they're part of microsoft's toolkit. run .exe, make request server, sends response of output program. here's how using php , ajax:

$.ajax({     type: "get",     url: 'run-executable.php',     success: function(data){         alert(data);     } }); 

on server, in file called run-executable.php within directory web page located:

<?php exec("/path/to/exe"); ?> 

make sure php has permissions run on server.


Comments