If you are using Media in your installation, which field formatter would you personally use when accepting both images and videos.? Whether using File field or Image field, you can set both of them to accept images and video. Just curious what other people are doing.

Comments

samwillc’s picture

Don't hold me to this, but I believe you just use 'File' field type for whatever you're uploading, be it a image/video/document.

I think the whole point of the media module is to just select 'File' and be done with it rather than having to preselect image, or video etc...

A good example is my stepson who I am helping to build a Drupal site (at 7 years old they have a rather unique take on things). So, we added a field 'Main image' and used image field (with media file selector widget). 10 minutes later... "How do I add a powerpoint presentation", another 10, "How do I add a video"... I was thinking "We can't! I chose image field and labelled it 'Main image' damnit!".

So, deleted that field. Then we used 'File' field instead (with media file selector widget), which now allows to add anything to this field, and labelled it with the more sensible, "Attach a file".

I may be wrong about using 'File' field but it makes sense to me to just use that, then set how the file is rendered in another area (/admin/structure/file-types). It does seem like another layer of complexity but it does make sense in my head, after it stops spinning.

I hope maybe this helps demonstrate not tying yourself down to only an image field!

rwilson0429’s picture

In my opinion, whether to use a field type of 'File' or 'image' really depends on your site needs and how much custom configuration you plan to put into it.

As samwillc stated, you can use the file field for any type of media. However, I find that it's a little more difficult to control the display size of your images when the field type is 'File'. In addition, I prefer to keep my media types separate fields. When the field type is 'File', the size of the displayed image is limited to whatever file View modes (Default, Full Content, Teaser, etc) you have established on the site. Of course, you can create a custom image size and assign it to an existing View mode but, I find this to be confining. However, there are several modules (for example: Display Suite and, Entity view modes modules) that allows you to create custom view modes and expand the options available to you.

On the other hand, if you select 'Image' as the field type, the image styles that you define at admin/config/media/image-styles are available for you to assign to your content displays. Image styles are simpler to add and configure than adding another module to create a custom view mode.

So, I would recommend that if the field will only hold images then, use the 'image' field type and use the 'file' field type for your other types of media.

jmo

ReggieW