Why cant you use the OOTB img.GET.java servlet here and get your image via:
`img = new Image(resource.getChild(String.valueOf(array.get(i))` ?

Ex. `<img src="/content/page/jcr:content/multiimageresource/image1.img.png" />` instead of selecting the sub-resource via the suffix.