Empresas
Empleos
  • Sobre nosotros
  • Soluciones
    • Publicación de vacantes
      Publica tu vacante y recibe candidatos calificados en 48h.
    • Evaluación de candidatos
      500+ pruebas técnicas y psicológicas, más anti-fraude.
    • Headhunting
      Búsqueda ejecutiva a la medida de principio a fin.
    • Nómina + EOR
      Dispersión de nómina y EOR en más de 15 países de LATAM.
  • Precios
  • Empleos

0

153
Vistas
Browser not showing preview of image for few images before upload

I am trying to show the preview of image before it is uploaded. However for some images the preview is shown while for others it shows a broken image. the only thing i can find out is the two images differ in their Photometric Interpretation. The images whose preview is not coming up have a Photometric Interpretation as RGB while for images whose preview is coming up have blank in their Photometric Interpretation property. My code is as below:

        <form method="post" action="" id="imageupload" enctype="multipart/form-data" name="imageuploadForm">
            <input type="file"  class="custominputfile" name="defectimagefile[]" multiple 
                id="defectimagefile" data-multiple-caption="{count} files selected" onchange="preview_image();"/>
            <label for="defectimagefile" ><span class="glyphicon glyphicon-upload">&nbsp; </span>Select File</label>
            
            <script> function preview_image(){
                        var total_file=document.getElementById("defectimagefile").files.length;
                        for(var i=0;i<total_file;i++){
                            url=URL.createObjectURL(event.target.files[i]);
                            $('#imgGallery').append("<img width='100' height='80' src='" + url+"'>");
                            document.getElementById("noofimgselected").innerHTML=total_file +  "  File(s) selected"
                        }
            </script>
        </form>
        
        <div id="imgGallery"></div>

Iam not able to solve the issue. Do i need to convert my images into some other formats?Please help.As shown in the photo preview of middle image in not coming up. This image has photometric interpretation as RGBon uploading images i see preview as shown in the pic below

image whose preview is not coming up

about 4 years ago · Juan Pablo Isaza
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Comercial
Legal
Términos y condiciones Política de privacidad
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomiéndame algunas ofertas
Necesito ayuda