我正在尝试创建一个幻灯片放映(与Galleria)与覆盖或"html层“,以显示文本的图像。但是我有很多页面要加载,所以它应该是动态的(你是这么叫它的吗?)覆盖文本应根据从中加载galleria的文件夹的不同而变化。
这是我拥有的代码,可以很好地根据文件夹的不同动态加载图像。
<div class="galleria">
<?php
//path to directory to scan
$directory = "./";
//get all image files with a .jpg extension.
$images = glob($directory . "*.jpg");
//print each file name
foreach($images as $image) {
echo "<img src=\"$image\">";
}
?>
</div>
<script>
Galleria.loadTheme('/galleria/themes/classic/galleria.classic.min.js');
Galleria.configure({
showCounter: false,
})
Galleria.run('.galleria');
</script>我认为galleria-data可能是一个解决方案,但不能让它工作。
<div class="galleria">
<?php
//path to directory to scan
$directory = "./";
//get all image files with a .jpg extension.
$images = glob($directory . "*.jpg");
//path to index file with needed text
$meas = glob($directory . "*.php");
//print each file name
foreach($images as $image) {
echo "<img src=\"$image\"";
echo " data-layer=\"$meas\">"; //only see "Array" written over the image
}
?>
</div>
<script>
Galleria.loadTheme('/galleria/themes/classic/galleria.classic.min.js');
Galleria.configure({
showCounter: false,
})
Galleria.run('.galleria');
</script>希望有人能帮助我,如果需要,我可以提供更多的信息。提前感谢!!
致以良好的问候,斯蒂芬
发布于 2021-02-25 04:33:36
echo " data-layer=\"$meas\">"; //only see "Array" written over the image试试这个:
echo " data-layer=".$meas.">"; //only see "Array" written over the imageHTH,TD
https://stackoverflow.com/questions/24609519
复制相似问题