|
Posted by Lorenzo Thurman on 11/20/06 17:50
Sanders Kaufman wrote:
> Lorenzo Thurman wrote:
>> Does anyone know how to validate a particular image type using PHP? If
>> I have a file and I want to ensure that it is a jpeg, how would go
>> about it? A sort of is_jpeg or is_gif is what I'm seeking.
>> TIA
>
> 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.
[Back to original message]
|