Responsive slider with images from a folder?

Hi!
Basically use the 2 slider OwlCarousel and Slick J.
There the structure of the slide:
the <div>1-image.jpg</div>
the <div>2-image.jpg</div>
the <div>3-image.jpg</div>

How to make automatic inlining of images from a specific folder?
ATO manually diva is inconvenient to write)

As I understand it, you need an array in php to write ?
And easier can be done?
June 10th 19 at 14:25
2 answers
June 10th 19 at 14:27
Solution
$fienames = glob('/foo/bar/*.jpg');
foreach ($filenames as $filename) {
 echo "<div>$filename</div>";
}

php.net/manual/ru/function.glob.php
It is necessary to create several DIVS, and inside write this php code? - Lisette commented on June 10th 19 at 14:30
or he is in order to make exactly as many DIVS as there are pictures? - Lisette commented on June 10th 19 at 14:33
Will make so much, how many elements will be in the returned array (read - image file directory).

Cool feature! To my shame - didn't know about it. - rhianna_Fee commented on June 10th 19 at 14:36
tell me please, where may be error? code white not working 5a36a49925699552456983.png - Lisette commented on June 10th 19 at 14:39
, turn on error reporting or look in the error log.
It seems that the path is incorrect, it is unlikely that you in the root FS folder is slick - Austen.Thompson53 commented on June 10th 19 at 14:42
June 10th 19 at 14:29
Solution
You can do this on the client side, not server.
for (i=0; i<3;i++) {
var img = document.createElement("img”);
img.src = "images/image" + i + ".png";
img.width = "150";
img.height = "150";
document.getElementById("templates").appendChild(img);
};
Will load photos from a folder on the server?
JS is able to work in the server file system? - Lisette commented on June 10th 19 at 14:32
Yes , you can just create a lot of tags with img tags inside and tell them to your server, folder image for example. The advantages of this methods is that you can automatically load images without reloading the page.
PS. Don't forget to put the boot images on the event window.onload - Lisette commented on June 10th 19 at 14:35
thank you! - rhianna_Fee commented on June 10th 19 at 14:38
But this will work only if the numbers of symbols in order. And where the script should know how many pictures of everything. - Lisette commented on June 10th 19 at 14:41

Find more questions by tags JavaScript