My problem is that I have a PHP that lists images in a folder (and it works fine; that’s not the problem) but I don’t know how to “call” the result in the HTML.
I have this PHP code:
<?php
$directory="img";
$dirint = dir($directory);
while (($archivo = $dirint->read()) !== false)
{
if (eregi("gif", $archivo) || eregi("jpg", $archivo) || eregi("png", $archivo)){
echo '<img src="'.$directory."/".$archivo.'">'."\n";
}
}
$dirint->close();
?>
And in my HTML I have:
<body>
<div id="gallery">
<img src="photo1.jpg" />
</div>
<script>
Galleria.loadTheme('galleria/themes/classic/galleria.classic.min.js');
$("#gallery").galleria({
width: 976,
height: 350,
show_imagenav:true
});
</script>
</body>
That works great, but I need to replace the <img src="photo1.jpg" /> for the list that PHP creates.
How do I do it?
You mean you want to combine these two examples?
The HTML file has to be a PHP file or PHP has to parse the *.html or *.htm file. And then you just need to replace your ” with the PHP code snippet so that it becomes: