tl;dr
Image gallery 1
- Get xss by uploading index.html in public dir
 - Use bf cache to get the flag.
 
Image gallery 2
- Slice files.js using nginx partial caching.
 - Use Subresource Integrity to load the right script
 - Use DOM clobbering and Cache probing to leak the flag uuid