Did you also consider enumerating the directory? That will get you all images files in it. In the general case there will only be one.  It is probably better this way, but just wanted to mention that it is a possibility.