Optimize photo gallery