Thats should be a bit more tight, maybe for the start
location ~ ^/([\d]+)/(images/)?([^/]*)/([\d]+)/([\d]+)/([^/]+)$ - so instead of . use [^/]

I'm not sure what $3 represents, but $6 could be even more tighten up (like \d\w\- etc.) - just to be safe. If it's possible with $3, then it should be done too (it probably contains letters only). Dots should be really the last resort, if we really have no idea what could be sent.