Hello, I have a code from a photo gallery but it shows only a white background when you open the page, only the photo will appear when you click on any .. I would like you to open a page with a photo in the gallery before you need to click on some. Here is the code:
<div class="localgaleria">
<script>
function div_tr_gt(u){
var gth_y = 'url('+u+')';
document.getElementById('i-div-imgh').style.backgroundImage = gth_y;
}
</script>
<?php
$pasta = 'imagens/fotos/cachacaria';
if ($handle = opendir($pasta)) {
/* Esta é a forma correta de varrer o diretório */
while (false !== ($file = readdir($handle))) {
echo'
<div id="i-div-imgh" class="div-img-pr" style="background-image:url('.$pasta.'/'.$file.');"></div>';
break;
}
closedir($handle);
}
echo'<div class="div-galeria">
<table>
<tr>';
foreach(glob(''.$pasta.'/{*.jpg,*.gif}', GLOB_BRACE) as $image) {
$img_p = "'";
$file = $fotos[] = $image;
$gty_array = array("",$img_p,$file,$img_p);
$rtyyui = implode("",$gty_array);
echo'<td><img onClick="div_tr_gt('.$rtyyui.');" src="'.$fotos[] = $image.'" width="50px" height="50px"></td>';
}
echo'</tr></table></div>';
?>
</div>