jeudi 17 octobre 2019

How to place randomly selected images from a database at random locations on a page?

I'm trying to display random images from a folder in random places on the page.

So far I've tried using php as I understand it is better suited to taking images randomly from larger databases. However I want to make the images draggable which I have achieved so far using javascript.

<?php
    $all_images = glob("/images/*.{jpeg|jpg|png|gif}", GLOB_BRACE);

    shuffle($all_images);

    list ($img1, $img2, $img3, $img4) = $all_images; 

What is missing? Do I need to add an echo or a img_src?




Aucun commentaire:

Enregistrer un commentaire