Extractors for mimetype & filesize would be useful for all local file media.
(Any else?)
Before (image source)

After (image and file sources, respectively)


| Comment | File | Size | Author |
|---|---|---|---|
| #16 | image_mapping_after.png | 55.24 KB | xjm |
| #16 | file_mapping_after.png | 46.86 KB | xjm |
| #16 | image_field_mapping_before.png | 54.69 KB | xjm |
| #14 | 2928798-interdiff-9-12.txt | 712 bytes | balsama |
| #13 | 2928798-12.patch | 3.89 KB | balsama |
Comments
Comment #2
geek-merlinTrivial patch flying in, untested yet.
Comment #3
geek-merlinWorks like a charm here.
Comment #4
geek-merlin;-)
Comment #5
jeetendrakumar commentedHi Axel,
Thanks for the initial patch!
I think we have a function to get the file size
getSize(), So we can use itWhat do you think?
Comment #6
geek-merlinYes, i simply missed \Drupal\file\Entity\File::getSize...
So we won't need to stat().
Here we go!
Comment #7
chr.fritschLooks good.
One small thing:
To be consistent with the image source, we should add this keys as class constants and use them instead.
Also, we should add a small test for that in
Drupal\Tests\media\FunctionalJavascript\MediaSourceFileTestComment #8
balsamaComment #9
balsamaAddressed #8.
Comment #10
phenaproximaSeems legit.
Comment #11
xjmI don't think this should be hyphenated nor have "Type" capitalized. Is there a place that we got this from?
Comment #12
phenaproximaFair enough.
Comment #13
balsamaThat came from thin air as far as I know. Changed there and in the const comment (which was also inconsistent). Thanks!
Comment #14
balsamaComment #15
phenaproximaCool beans. RTBC once Drupal CI is OK with it.
Comment #16
xjmSo the deal is that the File entity already provides the API for this, and all we're doing in this patch is exposing them for Media.
I was going to suggest a followup exposing the metadata to views, but one can already get this just by adding a relationship to the file entity in the view.
Screenshots!
Before (image source)
After (image and file sources, respectively)
Comment #18
xjmCommitted and pushed to 8.5.x. Thanks!