1

データベースから画像を取得してページに表示していますが、表示されません。画像がデータベースから呼び出されていることを確認するために、タイトルに画像名を出力します=見えない画像にマウスを置くと、画像名は表示されますが、画像自体はまったく表示されません。ウェブサイトはこれです: http ://clicktravelnstay.com/desti_list.php?details = 19

  <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コードです。

$(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);

          });


});



});
4

2 に答える 2

0

パス

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

404を返します(見つかりません)。

データベースからイメージ名を正常にプルしていますが、実際のイメージファイルがサーバーに存在しません。

于 2012-08-11T18:07:11.623 に答える
0

生成されたHTMLを確認する必要があります。

<a href=\"img/photos/" title="1344707033.png">
        ^--- bad escape.

無効なhtmlを出力していることに加えて、hrefは単なるパスであり、実際の画像を指していません。

つまり、次のことを意味します。

<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']いません。

于 2012-08-11T18:08:28.140 に答える