我正在使用Galleria插件来显示图库图像,我正在使用数组中的for循环从数据库中检索图像路径,但是我没有得到如何在galleria中使用它。任何人都可以帮帮我???
<?php
if (isset($_POST["show"]) && $_POST["show"] == "gallerypics"){
$picstring = "";
$gallery = preg_replace('#[^a-z 0-9,]#i', '', $_POST["gallery"]);
$user = preg_replace('#[^a-z0-9]#i', '', $_POST["user"]);
$sql = "SELECT * FROM photos WHERE user='$user' AND gallery='$gallery' ORDER BY uploaddate ASC";
$query = mysqli_query($db_conx, $sql);
while ($row = mysqli_fetch_array($query, MYSQLI_ASSOC)) {
$id = $row["id"];
$filename = $row["filename"];
$description = $row["description"];
$uploaddate = $row["uploaddate"];
$picstring .= "$id|$filename|$description|$uploaddate|||";
}
mysqli_close($db_conx);
$picstring = trim($picstring, "|||");
echo $picstring;
exit();
}
?>
this is Photo.php
the below javascript displays the images
<html>
<script>
function showGallery(gallery,user){
document.getElementById("galleria").style.display = "block";
document.getElementById("galleria").innerHTML = 'loading photos ...';
var ajax = ajaxObj("POST", "photo.php");
ajax.onreadystatechange = function() {
if(ajaxReturn(ajax) == true) {
document.getElementById("galleria").innerHTML = '';
var pics = ajax.responseText.split("|||");
for (var i = 0; i < pics.length; i++){
var pic = pics[i].split("|");
var abc = [{image :"user/'+user+'/'+pic[1]+'"};]
} /*pic[1] conatains file name, pic[2] contains image description. and so on*/
}
}
ajax.send("show=gallerypics&gallery="+gallery+"&user="+user);
}
</Script>
</body>
<Div id= Galleria></div>
<Script>
Galleria.loadTheme('galleria/themes/classic/galleria.classic.min.js');
Galleria.run('#galleria', { dataSource: 'abc' });
</script>
</body>
</html>
<!--in each for loop iteration pic[1] contain the file name
with this code i'm able to display all images properly'without galleria' in simple web page so please help out. to display in classic gallery theme -->
thank you