It is theoretically possible if you use relative urls like /gallery in the setup that it could operate however within several constraints. I have seen one person do this over the years.
1. You would need to have the proper number of licenses as they would be separate installs.
2. Both sites would need to be on the same server with open_basedir set off.
3. Both sites obviously would be installing using one database but on install the urls would simply be /gallery /photopost whatever for url settings. The server path however for the data directory would have to be set to one of the sites so the photos would be located in one place. Setting the urls to relative would allow the use of another install to use that url.
I do beleive if I remember right this is how the one customer I know of did it as years ago that is how I set it up.