Support for the file field of type "image" and its view modes and formatters

Created on 14 June 2013, over 12 years ago
Updated 23 September 2025, about 1 month ago

The file field in combination with the file_entity module and the file type specific view modes in D8 are the new way to go with files in general for the future. So the quote of some top contributors of D8 to this issue. That was one of the reasons why the file_entity module has been separated from the Media project. To fully be able to use this way in combination with views or other rendering logic, we need the same option to get the URL of a certain file type > image > view-mode > image style as a clear output to prevent users applying logic on the wrong places (like themes).

From the original issue OT:
I was surprised to see that it didn't have support for (this is not Media module specific) the file field of type image formatting in view modes.

In the forthcoming patch, you'll see that I added field formatter support for the general "file" field type. That alone does the trick, but URLs that request image style processing (on non-image files) totally fails. So I added a condition to using the image style processing URL to only apply to file types of "image". This has worked out smashingly for my use-case. I hope it's helpful for others as well.

πŸ› Bug report
Status

Needs work

Version

1.0

Component

Code

Created by

πŸ‡ΊπŸ‡ΈUnited States helior

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

No activities found.

Production build 0.71.5 2024