getRandomImagesAlbum() with recursive option

Is there an easy way to select random images from an album and its subalbums, in recursive mode?

Adding a parameter to getRandomImagesAlbum() would be great.

  • @param mixed $rootAlbum optional album object/folder from which to get the image.
    • @param bool $daily set to true to change picture only once a day.

Would it be difficult?
Or another recursive way already exists?

Thanks...

Tags:

Comments

  • acrylian Administrator, Developer
    edited July 2020

    Use get/printImageStatistics from the image_album_statistics plugin with its random option instead.

    These randomimages function will get deprecated soon and switch to use those function internally. The only thing special on these is teh "picture of day" option which will be moved to its own function.

  • Thanks. I will to that, it makes sense.

    Can you tell me more about new "picture of the day" own function?

    I used to use this option but it does not work for me so far (always same image chosen, even when day changes, strange).

    When will it be available (1.5.X ou in next major release)?

  • acrylian Administrator, Developer

    Can you tell me more about new "picture of the day" own function?I used to use this option but it does not work for me so far (always same image chosen, even when day changes, strange).

    It might be a bug in this old function. Generally it chooses one random image and stores it so the whole day that image is shown and not a new random one each page visit. The new function will just mirror this behaviour by using the iamge_album_statistics function internally and it will be part of the plugin then.

    That change likely will be in 1.5.8.

  • I confirm it is buggy. Looking forward for 1.5.8 then ;-)

  • acrylian Administrator, Developer

    Random is of course a bit random, so if for some reason it randomly picks the same image again, there is not much to be done unless extra checks. But I think this is really not much of an issue to actual visitors.

    Also if you have the html cache enabled with a long time frame until it updates itself there will be naturally no change until then.

  • For sure, I have tested with deactivated html cache and cleared it but always same image is picked again and again... What is strange is when I force update with CTRL+F5, a new image appears. But at the second loading, it always comes back to previous image. It is strange... I will wait until the new function then.

  • acrylian Administrator, Developer

    What is strange is when I force update with CTRL+F5, a new image appears. But at the second loading, it always comes back to previous image. It is strange.

    This somehow sounds like a too persistent browser cache. It is really overly persistent these days with all browsers I know (and on most you cannot even disable it anymore) and you constanlty have to force clear it several times when testing CSS…

Sign In or Register to comment.