How to change cover photo [closed]

0

How to update photo of this cover from my computer with javascript, button input type="file" or with nodejs.

asked by anonymous 13.07.2017 / 19:36

1 answer

2

To update the image in real time you can try:

  function showThumbnail(filess) {
    var url = filess.value;
    var ext = url.substring(url.lastIndexOf('.') + 1).toLowerCase();
    if (filess.files && filess.files[0]&& (ext == "gif" || ext == "png" || ext == "jpeg" || ext == "jpg")) {
      var reader = new FileReader();
        reader.onload = function (e) {
          document.getElementById('fotoCapa').setAttribute('src', e.target.result);
      }
      reader.readAsDataURL(filess.files[0]);
    }
  }
<input type="file" id="upload" onchange="showThumbnail(this);"/>


<div class="imagem">
  <img id="fotoCapa" src="https://return-true.com/wp-content/uploads/2013/06/jquery-tabs-html5-history.png"></div>

Ifyouwanttosavethisimageyoucanuseajaxorsubmitasaform.

RegardingpureJavaScriptajaxthissitehasacompleteexample: SITE >

    
13.07.2017 / 19:48