Forums

The forums ran from 2008-2020 and are now closed and viewable here as an archive.

Home Forums Back End Randomising images

  • This topic is empty.
Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #279752
    teckthekid
    Participant

    Hello,

    I need some help please.

    I have part of code:

    https://codepen.io/anon/pen/EOMxRJ

    How can I randomise .jpg number in w way that there will be no same picture showed few times and data-image will be the same as img src

    Please help.

    #279754
    Beverleyh
    Participant

    I’m assuming that because you posted this question in the backend forum, you want to do this with PHP?

    If that’s the case, try generating a number via mt_rand() and then assign it to a variable. You can then echo the same variable/number into your src and data-image.

    More info on mt_rand() here http://php.net/manual/en/function.mt-rand.php

Viewing 2 posts - 1 through 2 (of 2 total)
  • The forum ‘Back End’ is closed to new topics and replies.