Random image

Hello.
I need a script to show on my page “picture of the day”. That mean every day a new picture from destination folder in my media. Once a month I will add new pictures in that folder.
There is a way to do it with collections, but I want it easier.
Just load pictures in my media and script do else work.
How to do that?

I don’t think it’s currently possible without using a collection.

Thats really not nice. Can I use php on wix pages?

@fotoama No. It’s not supported.

@fotoama Don’t over complicate yourself. The only difference between uploading to the media manager vs a database collection is that you won’t have folders.

The easiest way to code would be to have 1 image per record.
If you already have your images uploaded then just copy and paste the host URL into a database collection (or onto a spreadsheet to import that data later). Or you can re upload each image 1 by 1.

You can also use 1 gallery field instead (this would allow you to bulk upload into a single field) but it would complicate the randomization code.

That is the only method to use if you are looking to automate a different daily image via code.

Actually if you write some code for image upload and you set the onFileUploaded( ) event handler, you can let the collection record be created automatically (but this event listener only apply for imaged uploaded using Corvid code).

@code-queen The point is that I cannot add images to the collection directly, I must first add them to the media manager and then to the collection. This is an unnecessary action and I want to avoid it.

Thank you, that is interesting future, but I don’t need to add all my pictures into day image collection. I need only defined part of them (contain on one folder).

Maybe there is a way to do it with JS?

@fotoama you don’t have to add them all to this collection.
You can define specific conditions which will be added and which will not.
When you use upload( ) you can define folder to which they’ll be uploaded and you can also define that only these images will be added to the collection.

@jonatandor35 Thank you. I tryed, but I can upload just by 1 picture, right? Tahts is not nice, if I want to upload 30 pics (for a mounth).