0
I have a code in PHP, which displays all the images of a certain folder, but I wonder if it is possible to LINK with a <a href="link"></a>
each image(knowing the order) determining a sequence in the code or similar to this.
Does anyone have any idea or examples from the code below?
<?php
$pasta = 'img/img_anuncios/';
$arquivos = glob("$pasta{*.jpg,*.png,*.gif,*.bmp}", GLOB_BRACE);
foreach($arquivos as $img){?>
<a target="_blank" href="<?php echo $img; ?>" id="example1"><img class="mySlides w3-animate-fading" src="<?php echo $img; ?>" id="teste1" style="width: 250px; height: 220px;"/></a>
<?php }
?>
EDIT:
SOMETHING SIMILAR TO THIS (HTML):
<a target="_blank" href="LINK" ><img class="mySlides w3-animate-fading" src="img/calcemp_nova.png" id="teste1" style="width: 250px; height: 220px;"></a>
<a target="_blank" href="LINK" ><img class="mySlides w3-animate-fading" src="img/cohncor.png" id="teste1" style="width: 250px; height: 220px;"></a>
<a target="_blank" href="LINK" ><img class="mySlides w3-animate-fading" src="img/indemp_nova.png" id="teste1" style="width: 250px; height: 220px;"></a>
The way she’s not linking?
– Woss
Yes, the link image. I wondered if it is possible to make a "private link" for each image, instead of creating one for each one in html.
– Jean Alves
I could not understand what you want to do. It has how to put an example of HTML that should be generated from this logic?
– Woss
editei, put HTML. In this case I need to keep adding each line.
– Jean Alves
But your code doesn’t exactly generate this HTML that you’ve placed?
– Woss
Yes, it does. I don’t think I can explain it. I’ll try to simplify it. It is possible to link the images by directing to an external link ( each image), instead of linking to the image itself in the PHP code above?
– Jean Alves