Usually, those types of webpages are created using server-side scripting and a database. The images or videos are part of the database, and a query call to the database (within a webpage's coding) displays them. Further, the server-side scripting can enable you to define a maximum of results per page. Don't get this mixed up with regular/static HTML coding -- this is a totally different animal because the pages are created dynamically, according to the number of records in the database.
The program recommended to you is a good and well-known one. If you read the capabilities of it, you'll see that it pretty much follows your outlined needs. Before using it, though, make sure that your web host's server is the correct platform.