MediaData implements IContentMedia. If you only want to get images, you can call with CommerceImage instead.
I have no idea why it "suddenly" happen to you
My bad. We had some problems and modified the ValidateCorrectType() and there for a PDF was considered a valid image.
We have used the Quicksilver extension for getting images for a product. All of a sudden it also returns pdf files.
Up until now the above code gave me only images. Has this function been updated?
The PDF is GenericData
And images are ImageMediaData: