首页
学习
活动
专区
圈层
工具
发布
首页
学习
活动
专区
圈层
工具
MCP广场
社区首页 >问答首页 >我的图像根本不显示

我的图像根本不显示
EN

Stack Overflow用户
提问于 2012-08-12 02:01:10
回答 2查看 81关注 0票数 1

我正在从数据库中拉出我的图像,以便在我的页面上显示它,但是它不会显示。为了确认图像是从数据库中调用的,我在title=上输出了图像名称。当您将鼠标放在看不见的图像上时,您可以看到图像名称,但是图像本身根本不会显示。网址是:http://clicktravelnstay.com/desti_list.php?details=19

代码语言:javascript
运行
复制
  <div id="imgdisplay">
                     <div class="pagecontainer">
                         <div class="galleryCredit">Hotel Photos</div>
                         <div class="galleryType">Preview</div>
                         <div class="clear_both"></div>
                         <div class="galleryContent">
                                 <!--image goes herewidth:650px; height:300px;-->
                                 <!--This is Where the wide image and the caption icon will be placed-->
                                    <div class="galleryThumbnail">
                                    <?php
                                        $query = "SELECT * FROM image WHERE hotel_id = {$hotel['hotel_id']}";
                                                  $image_set =  mysql_query($query,$connection);
                                                  while($image = mysql_fetch_array($image_set)){?>
                                                  <a href=\"img/photos/<?php $image['image_url'];?>" title="<?php echo $image['image_url']?>">
                                                  <img src="img/photos/<?php echo $image['image_url'];?>" width="75" height="75"/></a>           
                                                  <?php } ?> 
                                    <div class="clear_both"></div>
                                    </div>
                                    <div class="galleryPreview">
                                    </div>
                                    <div class="clear_both"></div>
                                    <div class="clear_both"></div>
                                    <div class="gallery_preload_area"></div>
                            </div>



                     <!--image goes herewidth:650px; height:300px;-->


                     </div>

以下代码是图片库的Jquery代码。

代码语言:javascript
运行
复制
$(document).ready(function(){

$(".galleryThumbnail a").click(function(e){
     e.preventDefault();

     //update thumbnail
     $(".galleryThumbnail a").removeClass("selected");
     $(".galleryThumbnail a").children().css("opacity","1");

     $(this).addClass("selected");
     $(this).children().css("opacity",".4");

     //setup thumbnails
     var photoCaption = $(this).attr('title');
     var photofullsize =$(this).attr('href');

         $(".galleryPreview").fadeOut(500, function(){ 

         $(".gallery_preload_area").html("")  
           // this is what is going to happen after the fadeout
           $(".galleryPreview").html("<a  href='"+ photofullsize +"' style=' background-image:url("+photofullsize+");'></a>");
           $(".galleryCaption").html("<p><a href='"+photofullsize+"' title='Click to view large'>View Large</a></p><p></p>")    
           $(".galleryPreview").fadeIn(500);

          });


});



});
EN

回答 2

Stack Overflow用户

回答已采纳

发布于 2012-08-12 02:07:12

路径

http://clicktravelnstay.com/img/photos/1344707033.png

返回404 (未找到)。

您正在成功地从数据库中提取图像名称,但服务器上不存在实际的图像文件。

票数 0
EN

Stack Overflow用户

发布于 2012-08-12 02:08:28

您应该查看生成的HTML:

代码语言:javascript
运行
复制
<a href=\"img/photos/" title="1344707033.png">
        ^--- bad escape.

您输出的是无效的html,而且href只是一个路径,而不是指向实际的图像。

这意味着:

代码语言:javascript
运行
复制
<a href=\"img/photos/<?php $image['image_url'];?>" title="<?php echo $image['image_url']?>">
                          ^---missing 'echo' 
    <img src="img/photos/<?php echo $image['image_url'];?>" width="75" height="75"/></a>

而且$image['image_url']也不包含任何东西。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/11916346

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档