• Resolved johnda

    (@johnda)


    Hello guys,

    I would like to have a specific function for my wordpress membership website and would like to know if you can suggest any code algorithm or a plugin for that matter , or perhaps a better idea how that could work even better. So it is pretty much an automated image gallery sorting time loop for the featured image in a gallery grid. Say I upload an picture now and another 30 minutes later all from my S3 cdn bucket links to my gallery. Now the 1st was pushed to the 2nd place but every X time I will want it to push the one infront of it and move upwards. So say I have 3 images , the 1st the 2nd and the 3rd. After X time, every image moves one spot higher [for the 1st, lower] the 3rd becomes the 2nd, the 2nd becomes the 1st and the 1st becomes the 3rd, like an circular image traffic. The idea is to give each members image chance to be viewed at the top for an amount of time and not get lost in a sea of pages. So c goes to b , b goes to a , a goes to c [in a set time loop, 24/7]

    Thanks
    John

    • This topic was modified 3 years, 9 months ago by johnda.
Viewing 4 replies - 1 through 4 (of 4 total)
  • Moderator bcworkz

    (@bcworkz)

    There are a number of “slider” plugins that will run an automated “slideshow” of certain images. The images used are usually specified through some backend UI implemented by the plugin. Depending on the plugin, it might be possible to specify images be taken from S3 if the plugin offers some sort of hook for the purpose. The custom hook callback would need some way to know which S3 images to use.

    Thread Starter johnda

    (@johnda)

    Hi bcworkz , thanks for the suggestion to use a slider. I went through a list of some of those slider plugins but all seem to offer the same thing, 1 row with parallel images 1 at a time. I am more interested in deploying movement, for the gallery as a whole instead of having to use many sliders that will only show 1 image at a time. Imagine one grid with multiple columns and rows of single images in which lets say we got 5 columns and 5 rows. Column 2 row 1 image will move after x amount of time to column 1 row 1 which as a result will make Column 1 row 1 image move to Column 5 row 5 and so on, pushing its next, one spot upwards.
    Maybe it is rather complicated and will need some sophisticated code …

    • This reply was modified 3 years, 9 months ago by johnda.
    • This reply was modified 3 years, 9 months ago by johnda.
    Moderator bcworkz

    (@bcworkz)

    I think I get what you’re after now. More like a grid of posts, and all that is shown of the posts is their featured image. You’d like the order of the images/posts rotated on some regular interval. A posts query returns an array of query results ordered a certain way. None of the ordering options will rotate order, but you could rotate the array elements with PHP as long as the initial order is consistent. It’s not that complicated or sophisticated. There is no “array_rotate” function in PHP, but it’s a common algorithm, using a combination of array_shift() and array_push(). Do a search to find specific examples.

    The algorithm rotates one step. Repeat as many times as needed. How many times can be determined from the modulo result of some sort of time related division. For example, if there are 6 images/posts being displayed, $time_of_day_hours % 6 will return 0-5 sequentially every hour.

    I used featured images as an example, but posts could relate to S3 images instead. You’d be querying and manipulating posts, but the post’s output would link to S3 images instead of local images.

    Thread Starter johnda

    (@johnda)

    Hi bcworkz,

    Gotcha , alright im going to keep that in mind for the feature but as for now I am delaying that part of the website.

    Thank you for reaching out

    John

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘Time loop for sorting featured image in the gallery automatically every X time.’ is closed to new replies.