Restricting selection to a specific folder for use as an image file

2018-04-10 20:58:36

The requirement is to have an image field that is not the standard one but rather a pulldown list of images from a specific folder. I can get this to work on the backend by using a droplist field or droplink field and pointing the Source item of the field to the folder in question, however, trying to then retrieve the actual image in code has proved problematic. I can't seem to cast the item to a mediaitem (it yields null), so I'm wondering if this scenario is typically handled in a different way or are there solutions I've just not been able to find?