Sitecore Fundamentals: Is Item a Content / Media Item
A quick code snippet to check whether a sitecore item is a Content item or a media item.
Decompiling the above code, you can see that is simply checks whether the path contains "sitecore/content" or "sitecore/Media library" respectively. Using the above code snippet however if the sitecore API ever changes sitecore will update these methods.