Empresas
Empregos
  • Sobre nós
  • Soluções
    • Publicação de vagas
      Publique sua vaga e receba candidatos qualificados em 48h.
    • Avaliações de candidatos
      Mais de 500 testes técnicos e psicológicos, mais anti-fraude.
    • Headhunting
      Busca executiva personalizada do início ao fim.
    • Folha de Pagamento + EOR
      Dispersão de folha e EOR em mais de 15 países da LATAM.
  • Preços
  • Empregos

0

151
Visualizações
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 à pergunta
Encontrar trabalhos remotos

Descubra a nova forma de encontrar um emprego!

melhores empregos
Principais categorias de trabalho
Empresas
Postar vaga Preços Comercial
Jurídico
Termos e Condições Política de privacidade
© 2026 PeakU Inc. All Rights Reserved.
Andres GPT
Recomende algumas ofertas para mim
Preciso de ajuda