Re: [PHP-DEV] getimagetype() broken for jpegs?

2002-10-02 Thread Andrei Zmievski

On Tue, 01 Oct 2002, Rasmus Lerdorf wrote:
> So result is never filled in as it doesn't think we hit any markers.  Yet
> a "file foo.jpg" returns:
> 
>   foo.jpg: JPEG image data, JFIF standard 1.02, resolution (DPI), 72 x 72
> 
> I have tried it with a number of different jpegs.  My libjpeg is:
> 
>   libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x40557000)
> 
> Can someone recreate this in current CVS HEAD?

Nope, it works fine for me.

-Andrei   http://www.gravitonic.com/

Give a man a fish; you have fed him for today.  Teach a man to use
the Net and he won't bother you for weeks.
   -Author unknown

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




Re: [PHP-DEV] getimagetype() broken for jpegs?

2002-10-02 Thread Rasmus Lerdorf

Hrm...  Actually, after a bit more checking it is only some jpegs that
don't work.  Specifically the ones coming from my digital camera are no
longer working.  Images that used to work with getimagesize() are now not,
so I think something changed.  Try running getimagesize() on this image:

  http://lerdorf.com/azj.jpg

-Rasmus

On Wed, 2 Oct 2002, Andrei Zmievski wrote:

> On Tue, 01 Oct 2002, Rasmus Lerdorf wrote:
> > So result is never filled in as it doesn't think we hit any markers.  Yet
> > a "file foo.jpg" returns:
> >
> >   foo.jpg: JPEG image data, JFIF standard 1.02, resolution (DPI), 72 x 72
> >
> > I have tried it with a number of different jpegs.  My libjpeg is:
> >
> > libjpeg.so.62 => /usr/lib/libjpeg.so.62 (0x40557000)
> >
> > Can someone recreate this in current CVS HEAD?
>
> Nope, it works fine for me.
>
> -Andrei   http://www.gravitonic.com/
>
> Give a man a fish; you have fed him for today.  Teach a man to use
> the Net and he won't bother you for weeks.
>-Author unknown
>


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




Re: [PHP-DEV] getimagetype() broken for jpegs?

2002-10-02 Thread Andrei Zmievski

On Wed, 02 Oct 2002, Rasmus Lerdorf wrote:
> Hrm...  Actually, after a bit more checking it is only some jpegs that
> don't work.  Specifically the ones coming from my digital camera are no
> longer working.  Images that used to work with getimagesize() are now not,
> so I think something changed.  Try running getimagesize() on this image:
> 
>   http://lerdorf.com/azj.jpg

Yes, it doesn't work for me either. I don't see anything in image.c that
would have changed, so it must be something in the streams code,
perhaps?

-Andrei   http://www.gravitonic.com/

Commitment, n.:
Commitment can be illustrated by a breakfast of ham and eggs. The chicken
was involved, the pig was committed.

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




Re: [PHP-DEV] getimagetype() broken for jpegs?

2002-10-02 Thread Marcus Börger

At 15:42 02.10.2002, Andrei Zmievski wrote:
>On Wed, 02 Oct 2002, Rasmus Lerdorf wrote:
> > Hrm...  Actually, after a bit more checking it is only some jpegs that
> > don't work.  Specifically the ones coming from my digital camera are no
> > longer working.  Images that used to work with getimagesize() are now not,
> > so I think something changed.  Try running getimagesize() on this image:
> >
> >   http://lerdorf.com/azj.jpg
>
>Yes, it doesn't work for me either. I don't see anything in image.c that
>would have changed, so it must be something in the streams code,
>perhaps?


Yes i just checked it. When i replace php_stream_seek() with
php_stream_read() it works.

cvs -z3 -q diff ext\standard\image.c (in directory S:\php4-HEAD\)
Index: ext/standard/image.c
===
RCS file: /repository/php4/ext/standard/image.c,v
retrieving revision 1.69
diff -u -r1.69 image.c
--- ext/standard/image.c18 Sep 2002 20:37:24 -  1.69
+++ ext/standard/image.c2 Oct 2002 14:08:12 -
@@ -398,6 +398,7 @@
 {
 return M_EOI;/* we hit EOF */
 }
+   php_error_docref( NULL TSRMLS_CC, E_NOTICE, 
"Reading:'0x%02X'", marker);
 if ( last_marker==M_COM && comment_correction>0)
 {
 if ( marker != 0xFF)
@@ -436,7 +437,14 @@
 length = length-2;
 if (length)
 {
-   php_stream_seek(stream, (long)length, SEEK_CUR);
+   //php_stream_seek(stream, (long)length, SEEK_CUR);
+   unsigned char a[1];
+
+   while (length) {
+   php_stream_read(stream, a, 1);
+   length--;
+   }
+
 }
  }
  /* }}} */
@@ -483,6 +491,7 @@
 for (;;) {
 marker = php_next_marker(stream, marker, 1, ff_read 
TSRMLS_CC);
 ff_read = 0;
+   php_error_docref( NULL TSRMLS_CC, E_NOTICE, "Marker: 
'0x%02X'", marker);
 switch (marker) {
 case M_SOF0:
 case M_SOF1:



When using this patch you will see all markers:
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xE1'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Marker: '0xE1'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xFF'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xE2'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Marker: '0xE2'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xFF'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xE2'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Marker: '0xE2'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xFF'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xE2'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Marker: '0xE2'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xFF'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xDB'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Marker: '0xDB'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xFF'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xC4'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Marker: '0xC4'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xFF'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xDD'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Marker: '0xDD'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xFF'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Reading:'0xC0'
Command line code(1) : Notice - getimagesize() 
[http://127.0.0.1/phpManual/function.getimagesize.html]: Marker: '0xC0'

Before only the 

Re: [PHP-DEV] getimagetype() broken for jpegs?

2002-10-02 Thread Rasmus Lerdorf

Just to make sure I am not crazy, I checked 4.2.3.  getimagesize() on that
azj.jpg image returns:

array(6) {
  [0]=>
  int(1536)
  [1]=>
  int(1024)
  [2]=>
  int(2)
  [3]=>
  string(26) "width="1536" height="1024""
  ["bits"]=>
  int(8)
  ["channels"]=>
  int(3)
}

which is correct.  So we definitely do have breakage

The streams related change was:

-   FP_FREAD(temp, sizeof(temp), socketd, fp, issock);
-   FP_FREAD((char*) &dim, sizeof(dim), socketd, fp, issock);
+   php_stream_read(stream, temp, sizeof(temp));
+   php_stream_read(stream, (char*) &dim, sizeof(dim));

-   if((FP_FREAD(a, sizeof(a), socketd, fp, issock)) <= 0) return 0;
+   if((php_stream_read(stream, a, sizeof(a))) <= 0) return 0;

Along with a few more, but they look correct to me, so I don't think the
problem is there.

I am more suspicious of the php_next_marker() changes..  But who knows,
the unified diff of image.c is 958 lines between 4.2.3 and current HEAD.

-Rasmus

On Wed, 2 Oct 2002, Andrei Zmievski wrote:

> On Wed, 02 Oct 2002, Rasmus Lerdorf wrote:
> > Hrm...  Actually, after a bit more checking it is only some jpegs that
> > don't work.  Specifically the ones coming from my digital camera are no
> > longer working.  Images that used to work with getimagesize() are now not,
> > so I think something changed.  Try running getimagesize() on this image:
> >
> >   http://lerdorf.com/azj.jpg
>
> Yes, it doesn't work for me either. I don't see anything in image.c that
> would have changed, so it must be something in the streams code,
> perhaps?
>
> -Andrei   http://www.gravitonic.com/
>
> Commitment, n.:
> Commitment can be illustrated by a breakfast of ham and eggs. The chicken
> was involved, the pig was committed.
>


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




Re: [PHP-DEV] getimagetype() broken for jpegs?

2002-10-02 Thread Wez Furlong

Yep, it's probably the streams code (specifically the seeking that marcus
mentioned).
Also, I think there is now a slight bug with fopen wrappers under win32.

I'm all of a sudden really pushed for time, so I might not be able to fix this
before saturday - if that is the case, I'll make an effort to get it sorted
on saturday.

--Wez.

On 10/02/02, "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote:
> Just to make sure I am not crazy, I checked 4.2.3.  getimagesize() on that
> azj.jpg image returns:
> 
> array(6) {
>   [0]=>
>   int(1536)
>   [1]=>
>   int(1024)
>   [2]=>
>   int(2)
>   [3]=>
>   string(26) "width="1536" height="1024""
>   ["bits"]=>
>   int(8)
>   ["channels"]=>
>   int(3)
> }
> 
> which is correct.  So we definitely do have breakage
> 
> The streams related change was:
> 
> - FP_FREAD(temp, sizeof(temp), socketd, fp, issock);
> - FP_FREAD((char*) &dim, sizeof(dim), socketd, fp, issock);
> + php_stream_read(stream, temp, sizeof(temp));
> + php_stream_read(stream, (char*) &dim, sizeof(dim));
> 
> - if((FP_FREAD(a, sizeof(a), socketd, fp, issock)) <= 0) return 0;
> + if((php_stream_read(stream, a, sizeof(a))) <= 0) return 0;
> 
> Along with a few more, but they look correct to me, so I don't think the
> problem is there.
> 
> I am more suspicious of the php_next_marker() changes..  But who knows,
> the unified diff of image.c is 958 lines between 4.2.3 and current HEAD.
> 
> -Rasmus
> 
> On Wed, 2 Oct 2002, Andrei Zmievski wrote:
> 
> > On Wed, 02 Oct 2002, Rasmus Lerdorf wrote:
> > > Hrm...  Actually, after a bit more checking it is only some jpegs that
> > > don't work.  Specifically the ones coming from my digital camera are no
> > > longer working.  Images that used to work with getimagesize() are now not,
> > > so I think something changed.  Try running getimagesize() on this image:
> > >
> > >   http://lerdorf.com/azj.jpg
> >
> > Yes, it doesn't work for me either. I don't see anything in image.c that
> > would have changed, so it must be something in the streams code,
> > perhaps?
> >
> > -Andrei   http://www.gravitonic.com/
> >
> > Commitment, n.:
> > Commitment can be illustrated by a breakfast of ham and eggs. The chicken
> > was involved, the pig was committed.
> >




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




Re: [PHP-DEV] getimagetype() broken for jpegs?

2002-10-03 Thread Marcus Börger

Wez,

the getimagesize() failure was in the streams read function and not as 
expected
in the seeker function. I also checked some others which seem ok but do not
have much time for now.

marcus

p.s.: Thanks for the image to rasmus. Let me guess it's your son?
   May i add the image to my test images? I would add a comment
   in the exif header of cause...


At 16:27 02.10.2002, Wez Furlong wrote:
>Yep, it's probably the streams code (specifically the seeking that marcus
>mentioned).
>Also, I think there is now a slight bug with fopen wrappers under win32.
>
>I'm all of a sudden really pushed for time, so I might not be able to fix this
>before saturday - if that is the case, I'll make an effort to get it sorted
>on saturday.
>
>--Wez.
>
>On 10/02/02, "Rasmus Lerdorf" <[EMAIL PROTECTED]> wrote:
> > Just to make sure I am not crazy, I checked 4.2.3.  getimagesize() on that
> > azj.jpg image returns:
> >
> > array(6) {
> >   [0]=>
> >   int(1536)
> >   [1]=>
> >   int(1024)
> >   [2]=>
> >   int(2)
> >   [3]=>
> >   string(26) "width="1536" height="1024""
> >   ["bits"]=>
> >   int(8)
> >   ["channels"]=>
> >   int(3)
> > }
> >
> > which is correct.  So we definitely do have breakage
> >
> > The streams related change was:
> >
> > - FP_FREAD(temp, sizeof(temp), socketd, fp, issock);
> > - FP_FREAD((char*) &dim, sizeof(dim), socketd, fp, issock);
> > + php_stream_read(stream, temp, sizeof(temp));
> > + php_stream_read(stream, (char*) &dim, sizeof(dim));
> >
> > - if((FP_FREAD(a, sizeof(a), socketd, fp, issock)) <= 0) return 0;
> > + if((php_stream_read(stream, a, sizeof(a))) <= 0) return 0;
> >
> > Along with a few more, but they look correct to me, so I don't think the
> > problem is there.
> >
> > I am more suspicious of the php_next_marker() changes..  But who knows,
> > the unified diff of image.c is 958 lines between 4.2.3 and current HEAD.
> >
> > -Rasmus
> >
> > On Wed, 2 Oct 2002, Andrei Zmievski wrote:
> >
> > > On Wed, 02 Oct 2002, Rasmus Lerdorf wrote:
> > > > Hrm...  Actually, after a bit more checking it is only some jpegs that
> > > > don't work.  Specifically the ones coming from my digital camera are no
> > > > longer working.  Images that used to work with getimagesize() are 
> now not,
> > > > so I think something changed.  Try running getimagesize() on this 
> image:
> > > >
> > > >   http://lerdorf.com/azj.jpg
> > >
> > > Yes, it doesn't work for me either. I don't see anything in image.c that
> > > would have changed, so it must be something in the streams code,
> > > perhaps?
> > >
> > > -Andrei   http://www.gravitonic.com/
> > >
> > > Commitment, n.:
> > > Commitment can be illustrated by a breakfast of ham and eggs. The chicken
> > > was involved, the pig was committed.
> > >


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




Re: [PHP-DEV] getimagetype() broken for jpegs?

2002-10-03 Thread Rasmus Lerdorf

> p.s.: Thanks for the image to rasmus. Let me guess it's your son?
>May i add the image to my test images? I would add a comment
>in the exif header of cause...

Yup, that's Carl.  And go ahead.

-Rasmus


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