Business
Jobs
  • About Us
  • Solutions
    • Job Postings
      Post your job and receive qualified candidates in 48h.
    • Candidate Assessments
      500+ technical and psychological tests, plus anti-fraud.
    • Headhunting
      Tailor-made executive search from start to finish.
    • Payroll + EOR
      Payroll dispersal and EOR across 15+ LATAM countries.
  • Pricing
  • Jobs

0

318
Views
Cargue y muestre imágenes en IPFS a través de nft.storage usando javascript y php

Estoy tratando de leer un archivo de imagen y subirlo a IPFS usando la API nft.storage.

El siguiente código funciona al convertir la imagen a una cadena base64, pero el enlace nft.storage solo muestra la cadena, no como una imagen como se muestra aquí -> https://bafkreihxiweiopz4pfmqtub5klhsq7wuu7wrw24inbrozbl7cshd4uaqxq.ipfs.dweb.link/

SI decodifico la cadena, podría ver la imagen. ¿Cómo dejar que IPFS muestre la imagen en el enlace?

 <?php // image to string conversion $imagelink = file_get_contents($image_original_path); // image string data into base64 $encdata = base64_encode($imagelink); ?> <script> document.getElementById("test").addEventListener("click", function() { jQuery.ajax({ type: 'POST', url: 'https://api.nft.storage/upload', beforeSend: function(xhr) { xhr.setRequestHeader("Authorization", "Bearer eyJhbGciOiJIUzI1NiIsIn...") }, mimeType: 'multipart/form-data', // this too contentType: "image/png", cache: false, processData: false, data: "<?php echo $encdata; ?>", success: function(data) { console.log(data); process the JSON data etc }, error: function(data) { console.log(data); } }); }); </script>
about 4 years ago · Juan Pablo Isaza
Answer question
Find remote jobs

Discover the new way to find a job!

Top jobs
Top job categories
Business
Post vacancy Pricing Sales
Legal
Terms and conditions Privacy policy
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Show me some job opportunities
There's an error!