XML Images

How would I go about finding the dimensions of an image using XML? I’m making an image gallery that needs the dimensions, the images will be placed in different areas depending on whether or not they are landscape or portrait orientation. ie

if(width[imageindex] <= height[imageindex])

Currently, the program thinks both are NULL and are equal to each other because I don’t know how to fill the width/height arrays.

Any help is appreciated.