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
Comment #1
danyalejandro commentedConfirming: same situation and error here.
Comment #2
danyalejandro commentedComment #3
killtheliterate commentedSame
Comment #4
hk0023 commentedsubscribing
Comment #5
BeaPower commentedsame here...
Comment #6
BeaPower commentedSeems to have gone away after enabling Styles module...
Comment #7
rickvug commentedSubscribe.
Comment #8
Miria commentedSame here.
Comment #9
Tim Jones Toronto commentedThis 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.
(I am testing using Drupal 7.7).
Cheers.
Comment #10
Tim Jones Toronto commented** 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.
Comment #11
madeby commentedAlso getting these errors.
# 10 - What to you mean by 'Enabled displays'?
Comment #12
Tim Jones Toronto commented@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!
Comment #13
madeby commentedGot it and it seems to work. Fingers crossed! Thanks!.
Comment #14
Tim Jones Toronto commented@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.
Comment #15
daryand commentedTim,
Thanks for the help. Trying to use this method to solve a similar problem. Q: Are you using D7?
Thx
D
Comment #16
daryand commentedTim,
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
Comment #17
mpgeek commented