PHP ======= public function readImage() { header('Content-type: image/jpeg'); echo file_get_contents("http://app1.susalud.gob.pe/registro/Home/GeneraCaptcha?accion=image"); } =================================================================================================== JS ======= function getCaptcha(url_image) { fetch(url_image) .then(response => response.blob()) .then(images => { var reader = new window.FileReader(); reader.readAsDataURL(images); reader.onload = function () { var imageDataUrl = reader.result; let imageElement = document.getElementById('image'); imageElement.setAttribute("src", imageDataUrl); } }) } =================================================================================================== HTML =======