Reliable way to identify Ogg types?
Reliable way to identify Ogg types?
am 27.01.2010 04:23:24 von Michael Peters
When I use fileinfo on an uploaded Ogg file, the mime it returns is
Application/Ogg which is almost useless.
Is there a reliable php way, preferably without needing to execute shell
commands, to positively identify a file as Ogg Theora or Ogg Vorbis?
Thanks for suggestions.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Reliable way to identify Ogg types?
am 27.01.2010 04:41:50 von Paul M Foster
On Tue, Jan 26, 2010 at 07:23:24PM -0800, Michael A. Peters wrote:
> When I use fileinfo on an uploaded Ogg file, the mime it returns is
> Application/Ogg which is almost useless.
>
> Is there a reliable php way, preferably without needing to execute shell
> commands, to positively identify a file as Ogg Theora or Ogg Vorbis?
Judging by the return, the OS is looking at the mime.types file, which
(on my box at least) doesn't know anything more than this.
In order to get what you want, I'm afraid you might have to open the
file and examine its first few bytes using the data from
/usr/share/file/magic, which has a more thoroughgoing understanding of
ogg files. Unless someone's built a class which does this for you.
Paul
--
Paul M. Foster
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
Re: Reliable way to identify Ogg types?
am 27.01.2010 04:43:15 von Eric Lee
--001636ed7299d1ce11047e1d335c
Content-Type: text/plain; charset=UTF-8
Hi Micheal,
One of way for this should be by checking the header of the file with its
OggS magic number.
You may take a look at this page to see if it could help !
http://en.wikipedia.org/wiki/Ogg
But I'am confused that the mime type should be enough what type of data its
coming !
Are there are any more things you need to concern ?
Thanks,
Regards,
Eric,
On Wed, Jan 27, 2010 at 11:23 AM, Michael A. Peters wrote:
> When I use fileinfo on an uploaded Ogg file, the mime it returns is
> Application/Ogg which is almost useless.
>
> Is there a reliable php way, preferably without needing to execute shell
> commands, to positively identify a file as Ogg Theora or Ogg Vorbis?
>
> Thanks for suggestions.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
--001636ed7299d1ce11047e1d335c--
Re: Reliable way to identify Ogg types?
am 27.01.2010 07:17:29 von Michael Peters
Eric Lee wrote:
>
> Hi Micheal,
>
> One of way for this should be by checking the header of the file with
> its OggS magic number.
> You may take a look at this page to see if it could help !
>
> http://en.wikipedia.org/wiki/Ogg
>
>
> But I'am confused that the mime type should be enough what type of data
> its coming !
> Are there are any more things you need to concern ?
The problem is that fileinfo just reports application/ogg for both Ogg
Vorbis and Ogg Theora files, and I never want to trust extension or user
to properly identify file.
Maybe I need to update some library that fileinfo function is built
against or uses.
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php