开发者

Display .png image on a web page

开发者 https://www.devze.com 2023-03-11 08:57 出处:网络
i want to display images in my page, But the problem i am facing is my web page displaying all .jpeg images but it is not displaying *.png images why is it??

i want to display images in my page, But the problem i am facing is my web page displaying all .jpeg images but it is not displaying *.png images why is it??

$.getJSON("http://192.168.1.9:8983/solr/db/select/?wt=json&&start=0&rows=100&q="+q+"&json.wrf=?", function(result){
    var html="";
    // If no search results
    if(result.response.numFound==0)
    {
     html+= "<br>We're sorry, we found no results for <b>"+document.getElementById("queryString").value;
    }
    else
    {
      ht开发者_开发百科ml+= "<br>Total Results Found <b> "+ result.response.numFound+"</b> for "+"<b>"+document.getElementById("queryString").value+"</b> keyword";
        // Parse solr response and display it on web page
            $.each(result.response.docs, function(i,item){
             var src1=item.image;
             // Check if there is a image  
                if(src1!= null && src1!= ""){

                      html+="<p><br>"+"<img src="+src1+ " />";
                  }
            // If not insert a default image  
                  else
                  {

                      src1="images/products/default.bmp";
                      html+="<p><br>"+"<img src="+src1+ " />";
                  }
                  html += "<br>UID_PK: ="+ item.UID_PK;
                  html += "<br>Name: ="+ item.name;
                 // html += "<br>Description: ="+ item.description;
                 html+="<br>Price:="+item.price
            });
    }

            $("#result").html(html);


First try manually loading the images using the URL bar of your browser. If that works then there is a problem with your <img> tag or file path. Use Firebug or similar browser plugin to track it down.

If that doesn't work, and the file definitely exists, then it could be a MIME type issue with the server or file permissions. Check your server's error log for more information.

Hope that helps


 <img src="/path/to/my/image.png" alt="My Image" />


Check the file access permissions on your PNGs.

0

精彩评论

暂无评论...
验证码 换一张
取 消