Re: cvs: php4 /ext/standard image.c
| From: | Jani Taskinen | Date: | Wed, 16 May 2001 07:06:00 +0000 |
| Subject: | Re: cvs: php4 /ext/standard image.c | ||
| References: | 1 | Groups: | php.cvs |
| Request: | Send a blank email to php-cvs+get-5772@lists.php.net to get a copy of this message | ||
On Wed, 16 May 2001, Thies C. Arntzen wrote:
>On Tue, May 15, 2001 at 11:55:54PM -0700, Rasmus Lerdorf wrote:
>> > are you sure this is a wise thing to do? this code has been
>> > more-or-less taken from the ijg-jpeg and has been in there as
>> > long as this (getimagesize) function exists. could you send
>> > me a failing sample-image so i could see myself?
>>
>> It made my images work. Before this change none of the images that came
>> from my digital camera worked. And when I originally wrote/cloned the
>> code they certainly worked.
>
> the problem is that now we start parsing the jpeg-file with a
> 3-byte offset and not from the beginning. this was changed in
> order to allow GetImageSize work on remote images (no fseek()
> possible).
>
> i'm just not sure if this change(s alltogeter) won't break on
> other valid jpeg-images.
>
> the clean approach would be to buffer the 3 bytes that we
> need to identify the image as a jpeg and feed them back into
> the next_marker functions somehow.
From jdmarker.c:
<---clip--->
/* Skip any non-FF bytes.
* This may look a bit inefficient, but it will not occur in a valid file.
* We sync after each discarded byte so that a suspending data source
* can discard the byte from its buffer.
*/
while (c != 0xFF) {
cinfo->marker->discarded_bytes++;
INPUT_SYNC(cinfo);
INPUT_BYTE(cinfo, c, return FALSE);
}
<---clip--->