We have an add-on using which media gallery can be sorted based on file size, ascending, descending title, uploaded date.
Please, visit the product page here - https://rtmedia.io/products/rtmedia-sorting/ and
Documentation here - https://rtmedia.io/docs/addons/sorting/
You can analyze your requirement with the tutorials and have this addon easily.
Check out our live demo website here - http://demo.rtmedia.io/
Let us know if you have any doubt.