I *have* tried, Richard. It is not returning the state of the file.
Files that Irfanview recognizes are prograssive, your example code
does not.

Looking at C code in gd-2.0.33/gd_jpeg.c downloaded from
http://www.boutell.com/gd/ there is a comment:

 /* REMOVED by TBB 2/12/01. This field of the structure is
    documented as private, and sure enough it's gone in the
    latest libjpeg, replaced by something else. Unfortunately
    there is still no right way to find out if the file was
    progressive or not; just declare your intent before you
    write one by calling gdImageInterlace(im, 1) yourself.
    After all, we're not really supposed to rework JPEGs and
    write them out again anyway. Lossy compression, remember? */

The docs at http://www.boutell.com/gd/manual2.0.33.html#gdImageInterlace say

gdImageInterlace is used to determine whether an image should be
stored in a linear fashion, in which lines will appear on the display
from first to last, or in an interlaced fashion, in which the image
will "fade in" over several passes. By default, images are not
interlaced. (When writing JPEG images, interlacing implies generating
progressive JPEG files, which are represented as a series of scans of
increasing quality. Noninterlaced gd images result in regular
[sequential] JPEG data streams.)

A nonzero value for the interlace argument turns on interlace; a zero
value turns it off. Note that interlace has no effect on other
functions, and has no meaning unless you save the image in PNG or JPEG
format; the gd and xbm formats do not support interlace.

When a PNG is loaded with gdImageCreateFromPng or a JPEG is loaded
with gdImageCreateFromJpeg, interlace will be set according to the
setting in the PNG or JPEG file.
--------------

To me that means the code authors cannot determine what the state of
the file is, and are not returning a state they cannot determine.

Gerry




On 1/25/07, Richard Lynch <[EMAIL PROTECTED]> wrote:
Re-read the docs more carefully.

The second arg is optional, and it returns the PRIOR state of the
interlaced-ness (or progressive-ness for a JPEG).

Standard computer-science function trick to return prior state when
altering state, and to simply return state if the second arg is not
passed in.

So if you do not pass in a second arg, you should be getting the state
of the JPEG.

Try it.

On Wed, January 24, 2007 7:20 pm, Gerry Danen wrote:
> Richard,
>
> imageinterlace() turns the interlace bit on or off. It only returns 1
> if you set it to 1 as the second parameter...


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to