In your case you would probaly rename the photos to a random filename and store them in a folder somewhere. And then store the file location in the DB.
But why not use something like wordpress?
If you want a custom gui with wordpress use the rest api or make a theme. No need to reinvent the wheel.