Having installed 1.x-beta3/4/5, but not used the module much, I've just updated to 2.x-dev. I'm not sure whether this is due to using earlier versions but I just added a media (image) field to a content type and uploaded 2 new jpgs. When I viewed the node I got the following errors

Notice: Trying to get property of non-object in theme_file_link() (line 701 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in theme_file_icon() (line 739 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_path() (line 781 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_map() (line 823 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_path() (line 796 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_path() (line 796 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_path() (line 796 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_path() (line 796 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in theme_file_link() (line 708 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in theme_file_link() (line 708 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in theme_file_link() (line 714 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in theme_file_link() (line 701 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in theme_file_icon() (line 739 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_path() (line 781 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_map() (line 823 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_path() (line 796 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_path() (line 796 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_path() (line 796 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in file_icon_path() (line 796 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in theme_file_link() (line 708 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in theme_file_link() (line 708 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).
Notice: Trying to get property of non-object in theme_file_link() (line 714 of /Applications/MAMP/htdocs/hhp2011/modules/file/file.module).

After some digging around, I found admin/config/media/file-types/manage/image/file-display and saw that the default display was set to "Generic file". When I changed it to "Image", the errors disappeared and images were shown.

Is "Generic file" the expected default display type for an Image file type?

Comments

danyalejandro’s picture

Confirming: same situation and error here.

danyalejandro’s picture

Category: support » bug
Priority: Normal » Major
killtheliterate’s picture

Same

hk0023’s picture

subscribing

BeaPower’s picture

same here...

BeaPower’s picture

Seems to have gone away after enabling Styles module...

rickvug’s picture

Subscribe.

Miria’s picture

Same here.

Tim Jones Toronto’s picture

This type of error is happening on a *fresh* install of 7.x-1 too when using Views to use a Media formatter, with a 'Default' File view mode.

Short e.g.

Notice: Trying to get property of non-object in theme_file_link() (line 701 of C:\xampp\htdocs\modules\file\file.module).
Notice: Trying to get property of non-object in theme_file_icon() (line 739 of C:\xampp\htdocs\modules\file\file.module).
Notice: Trying to get property of non-object in file_icon_path() (line 781 of C:\xampp\htdocs\modules\file\file.module).
...etc.

(I am testing using Drupal 7.7).

Cheers.

Tim Jones Toronto’s picture

** UPDATE **

In my case above #9, I went to: Home » Administration » Configuration » Media » File types

Click 'manage file display' for Video (in my case).

Looking at the 'Enabled displays', nothing was set by default (null) so I set my display here for my type e.g.

Default | Link | Preview | Small | Large | Original

The error is now gone and working fine.

madeby’s picture

Also getting these errors.

# 10 - What to you mean by 'Enabled displays'?

Tim Jones Toronto’s picture

@11 Sorry, if you click 'manage file display' on your content type (eg. Video in my case) you get a page and will see 'Enabled displays'. Then just select at least one to suit your needs.

Hope this helps!

madeby’s picture

Got it and it seems to work. Fingers crossed! Thanks!.

Tim Jones Toronto’s picture

@13 cool, it seems that the 'property of non-object' was due to 'null' perhaps, so just setting one in the configuration works out here.

daryand’s picture

Tim,

Thanks for the help. Trying to use this method to solve a similar problem. Q: Are you using D7?

Thx
D

daryand’s picture

Tim,

Thx for the help. Q: are you using D7?
Also - are you matching a default image to a specific file type (Video). For example, if file type ends in .wmv .mp4 etc. the default image display is Timsfile.jpg?

If I understand this correctly, did you need to do any additional coding?

Thx,
D

mpgeek’s picture

Status: Active » Closed (works as designed)