javascript - save image generated by canvas from video image not saving -


i used following code generate image form video canvas method , works fine , displays image form video

how can save image in server,

    <video>         <source src="1.mp4" type="video/mp4">     </video>     <canvas>     </canvas>     <img id="screenshot" />     <script>     var context = canvas.getcontext('2d');     context.fillrect(0, 0, w, h);     context.drawimage(video, 0, 0, w, h);     var dataurl = canvas.todataurl();     document.getelementbyid('screenshot').src = dataurl; 

script save image

function savecanvas('canvas','pat/' , '.jpg', options) {                     return task.spawn(function * () {                     var reader = new filereader;                             var blob = yield new promise(accept = > canvas.toblob(accept, type, options));                             reader.readasarraybuffer(blob);                             yield new promise(accept = > { reader.onloadend = accept });                             return yield os.file.writeatomic('pat/', new uint8array(reader.result),                             { tmppath: 'pat/' + '.tmp' });                     });                             }      </script> 

is there way save image file random name


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -