Thanks for the feedback. Not sure exactly what you mean with, when would creating 30 thumbs be resource intensive? Quite some different places that could occur depending on approaches mentioned in the thread.
Regarding the lock, I’d really prefer to avoid going down that road as it’s an edge case that few would have and very seldom as I see it. If two browsers request the same thumbnail simultaneously, they will both generate it unless the database is updated when they check if the thumbnail has a resource. Not much harm done in that, unless you have lots of requests at the same time. In such cases one should use some sort of generation strategy (cronjob, queue) and it shouldn’t be a problem.