如何在Bootstrap模式下从MySQL打开图像?

时间:2014-10-21 19:43:37

标签: javascript php mysql twitter-bootstrap-3

我有以下PHP函数,而不是在新页面中打开图像如何在Bootstrap模式窗口中打开图像?

public function getApartmentmedia($appmtid){
global $bsiCore; 
$medialist='';
$mediagalleryres=mysql_query("select img_path from bsi_appmt_gallery where appmt_id=".$appmtid);
if(mysql_num_rows($mediagalleryres)){
    while($row=mysql_fetch_assoc($mediagalleryres)){
            $medialist.='<a href="gallery/ApartImage/'.$row['img_path'].'"><img src="gallery/ApartImage/thumb_'.$row['img_path'].'" alt=""></a>';
    } 
}else{
    $medialist.='<h2>No Photos Found</h2>'; 
}
$medialist.='';
return $medialist;
}

由于

1 个答案:

答案 0 :(得分:2)

将图片粘贴到具有唯一ID的隐藏div中,然后在您希望它出现时调用$('#modalId').modal('show');