[TYPO3-dam] media types

René Fritz r.fritz at colorcube.de
Thu Nov 30 00:33:50 CET 2006


> These lists
> are rather long ;-)

I don't care. So DAM will become the most largest extension ever :-)

> types are categorised? We had quit a good division at that time I think. At
> the moment some things seem to be mixed up. odt and tmpl are categorized as
> undefined, sxw as application etc. Files like odt, doc could be categorized
> as Text 

The list could be improved, for sure. I have currently not my focus on this 
topic. I can inlude types when you say me what and how.
Nevertheless I have on my todo list to provide configuration options which 
resource should be used for mime type detection (builtin or system dependent)

> as there is the Additional meta data field. These kind of files can 
> carry extra metadata.

I don't get this. I may misunderstand you, but that a file has meta data is 
independent of the detection of it's mime type, isn't it?

> http://www.iana.org/assignments/media-types/

An excerpt of the mime type list is already used in DAM. Unfortunately is that 
list not exactly what I think is right for DAM. For example 'pdf' is defined 
there as
	application/pdf 
and not as 
	text/pdf
Technically this may be correct but from a categorization like DAM use I would 
expect it of type 'text'. And that's how DAM has an additional internal list 
defined. Btw. Open Dokument formats are also defined as application/* in the 
mime type list not text.

Here's how media/mime type detection works (example.pdf):

- Get the file extension, This is 99.999% correct in my eyes so I trust this 
information: 'pdf'

- If we have a file extension use an internal array to get a mime type for: 
application/pdf

- if the internal list does not know the type mime_content_type() is used to 
get a mime type. Now the detection depends on the servers setup.

- if we still don't have a mime type or there's no file extension use 
the 'file' command to detect these

Now we know
file_type=pdf
file_mime_type=application
file_mime_subtype=pdf

An internal array is used to get the media type (text, image, ...) for a file 
type. This overrides the mime type and makes from an pdf of 
file_mime_type 'application' the media_type 'text'.
If that fails the file_mime_type is used.

The function
tx_dam::register_fileType()
can be used to define new types. So easily the internal lists can be 
customized by own extensions.

The internal arrays itself are in dam/lib/tx_dam_types.php and can be modified 
to but may change in the future.


greetings
René

-- 
COLORCUBE
digital media lab

www.colorcube.de


More information about the TYPO3-project-dam mailing list