dp9599 2013-03-02 10:50
浏览 55

如何将lightbox jquery效果应用于从数据库中检索到的图像

Hello pal's i need some help. I wanted to apply lightbox jquery effect on image gallery php file. I'm retrieving images from database which were stored in longblob format. i can get that effect by giving id value manually but by giving the variable like $id it's not providing that lightbox effect.... please check the below code and give some suggestions.

<div id="gallery">
<?php
$query = mysql_query("SELECT * FROM image_uploads") or die(mysql_error());
while($row = mysql_fetch_array($query)){
    $id = $row['entry_id'];
?>
<ul>
    <li>
        <a href="img_retrieve.php?oid=$id" $('#gallery').lightBox();">
            <img src="img_retrieve.php?sid=$id" width="72" height="72" alt="" />
        </a>
    </li>
</ul>
<?php
}
?> 
</div>

in retrieve page follows

if(isset($_GET['sid'])){
$id = $_GET['sid'];
$run = mysql_query("SELECT * FROM image_uploads WHERE entry_id=$id") or die(mysql_error());

    while( $images = mysql_fetch_array($run) ){
        $image = $images['s_image'];


        header("Content-type: image/jpeg");
        echo $image;
    }   
}

if(isset($_GET['oid'])){
    $id = $_GET['oid'];
    $run = mysql_query("SELECT * FROM upload_images WHERE entry_id=$id") or die(mysql_error());

    while( $images = mysql_fetch_array($run) )
        $s_image = $images['s_image'];


        header("Content-type: image/jpeg");
        echo $s_image;
    }
} 
  • 写回答

1条回答 默认 最新

  • douzong3599 2013-05-23 10:31
    关注
        if(isset($_GET['sid'])){
            $id = $_GET['sid'];
            $run = mysql_query("SELECT * FROM image_uploads WHERE entry_id=$id") or die(mysql_error());
    
            while( $images = mysql_fetch_array($run) ){
                $image = $images['s_image'];
    
                header("Content-type: image/jpeg");
                    echo $image;
            }   
        }
    
        if(isset($_GET['oid'])){
             $id = $_GET['oid'];
             $run = mysql_query("SELECT * FROM upload_images WHERE entry_id=$id") or die(mysql_error());
    
             while( $images = mysql_fetch_array($run) )
                 $s_image = $images['s_image'];
    
                 header("Content-type: image/jpeg");
                    echo $s_image;
             }
        } 
    
    评论

报告相同问题?

悬赏问题

  • ¥15 HFSS 中的 H 场图与 MATLAB 中绘制的 B1 场 部分对应不上
  • ¥15 如何在scanpy上做差异基因和通路富集?
  • ¥20 关于#硬件工程#的问题,请各位专家解答!
  • ¥15 关于#matlab#的问题:期望的系统闭环传递函数为G(s)=wn^2/s^2+2¢wn+wn^2阻尼系数¢=0.707,使系统具有较小的超调量
  • ¥15 FLUENT如何实现在堆积颗粒的上表面加载高斯热源
  • ¥30 截图中的mathematics程序转换成matlab
  • ¥15 动力学代码报错,维度不匹配
  • ¥15 Power query添加列问题
  • ¥50 Kubernetes&Fission&Eleasticsearch
  • ¥15 報錯:Person is not mapped,如何解決?