DevTen
DevTen

Reputation: 15

PHP - How to order images without MySQL

I use to upload images into folders giving them randomic names in order to avoid double names but now I need to order these images. I found a guide (with nice drug and drop method) but it needs to store images on database.
Is there a way to do it without passing for a database? Or better...is there a way to order them by saving only names and/or paths on db, keeping files in directories? I red that storing images on db is not the better solution so I'm searching for a guide for CRUD and sorting images (with or without a db, it depends on your advices).

How would you do it?

Thank you!

Upvotes: 0

Views: 142

Answers (1)

Parzibyte
Parzibyte

Reputation: 1598

Yes, you can save the path in the database and then query and order.

And you can get the files in a folder and then order them.

You can use scandir to get the files. It will return an array, and then you can sort the array using sort

Hope this helps

Upvotes: 1

Related Questions