|
Posted by Sanders Kaufman on 11/20/06 18:31
Lorenzo Thurman wrote:
> Sanders Kaufman wrote:
>> For each of the image specs (gif, tiff, jpg, etc) the first few bytes
>> identify what it is. If you can binary read the first few bytes with
>> PHP, then you can get that info... and usually a lot of other stuff
>> (dimensions, pallet, (c), etc.)
>>
> Thanks for the reply. Do you know what I should check for? I know image
> types often start with a unique binary header, but I don't know where to
> find that info.
Whole books have been written on it, so there's more
than I can say here - but I can tell you how to dig
up the info yourself.
Here's the GIF specification:
"http://www.w3.org/Graphics/GIF/spec-gif89a.txt"
As you can see from the spec's sections 12-17, the
first few bytes contain meta-info about the image -
including the fact that it's a GIF. (You can grab
any old GIF and read it into PHP to see how the spec
plays out in the actual file.)
Once you master retrieving meta data about a GIF,
you can do the same thing with the specs for other
image formats, too - including binaries like
executables, ZIP's, and java or .NET assemblies.
Navigation:
[Reply to this message]
|