create dynamic caption width for gallery