Board Thread:Suggestions/@comment-24800939-20170525011214/@comment-122657-20170807200110

It is tedious coding indeed.

I believe The addition principle was an attempt to ensure the layout wouldn't break if users skipped a number by accident. It would try to figure out when to start a new row when multiples of 3, 6, and 9 have been achieved.

I realized it's possible to reduce coding using remainders of division. If the addition of all previous images is divisible by 3 with no remainder, add a left break. Otherwise don't.

I added three additional images to the template, but it should be easier to add additional ones if you like. For each image you add, add another 'plus' to the addition equation for the previous image. (Image 16 has 2-15 added, Image 50 has 2-49 added). The rest of the equation can stay the same.

Hopefully that's what you were looking for. It's possible to reduce the code further by transcluding the viewable part, but that usually costs unnecessary processing time.

Keep in mind that every addition of an image is an additional if statement added to the processing time. It may not be an issue on a handful, but the more images you add the more the template has to calculate before it can display a result.

Two other options come to mind. 1, attempt to convert the comic template into using the portable infobox style with Lua like the film template, (X-Men: The Last Stand). Or 2, attempt to convert the cover or alternate section into a slideshow like the user template, (User:Peteparker).