[TYPO3-core] RFC: add a mehtod to determine the MIME Type of a file to t3lib_div

Martin Kutschker Martin.Kutschker at n0spam-blackbox.net
Wed Feb 21 14:49:01 CET 2007


Ingo Renner schrieb:
> 
> Am 21.02.2007 um 13:59 schrieb Martin Kutschker:
> 
>> Ingo Renner schrieb:
>>
>>> Hi *,
>>>
>>> This is a patch request.
>>>
>>> Branches: trunk
>>>
>>> Problem:
>>>
>>> A method to determine the MIME type of a file is needed from time to
>>> time, but is not available where one would expect it.
>>>
>>> Solution:
>>>
>>> Add a method getMimeType() to t3lib_div. The current alternative code
>>> for PHP's native function is taken from t3lib_htmlmail.
>>>
>>> Notes:
>>>
>>> There are several methods in TYPO3 to do this already they all  
>>> could  be
>>> consolidated to the new method.
>>> As we set the PHP version requirement to 4.3.0+ we could just use   this
>>> method as a pure wrapper for PHP's function mime_content_type().
>>
>>
>> mime_content_type() is deprecated and does not work like our  funtion. 
>> The
>> former does an extention-to-type mapping, the latter retrieves the  mime
>> type from the content header and is therefore working only for http
>> resources. The extention-to-type mapping takes place in
>> t3lib_htmlmail->getExtendedURL.
> 
> 
> ok, then forget it. In the reference I used mime_content type was not  
> marked as depricated. I also rechecked where I used htmlmail's  method, 
> you're right I used it with an URL but remembered to have it  used with 
> a path...
> 
> Anyway we should think about consolidating these methods in 4.2 maybe.

Sure. A new super-duper function for 4.2 in t3lib_div is fine with me.

Masi


More information about the TYPO3-team-core mailing list