[GD] Image errors

[GD] Image errors

am 14.07.2009 17:48:41 von Il pinguino volante

Hi to all

I get a problem processing an image with GD libraries.

This is my function

public function showPicture($id) {
header('Content-type: image/jpeg');
$mime = mime_content_type($this->updir.$id.'.png');
$type = explode('/',$mime);
$type = 'imagecreatefrom'.$type[1];
$immagine = $tipo($this->updir.$id.'.png');
imagejpeg($immagine,null,100);
imagedestroy($immagine);
}

If i commentize the "header" function i get a lot of strange simbols
(such as the code of a jpeg image!) but no errors.
The result of this code is a blank page. In Firefox the title sets to
"picture.php (JPEG image)" and if i right-click it and click on
"Proprieties" i get "0px × 0px (resized as 315px × 19px)".

P.S.: I get the same result when I write $immagine =
imagecreatefromjpeg(...)

(Sorry for my english)

Thanks in advance,
Alfio.

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

Re: [GD] Image errors

am 14.07.2009 18:27:55 von Martin Scotta

$immagine =3D $tipo($this->updir.$id.'.png');

$tipo is undefined


On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
volante wrote:
> Hi to all
>
> I get a problem processing an image with GD libraries.
>
> This is my function
>
> =A0 public function showPicture($id) {
> =A0 =A0 =A0 header('Content-type: image/jpeg');
> =A0 =A0 =A0 $mime =3D mime_content_type($this->updir.$id.'.png');
> =A0 =A0 =A0 $type =3D explode('/',$mime);
> =A0 =A0 =A0 $type =3D 'imagecreatefrom'.$type[1];
> =A0 =A0 =A0 $immagine =3D $tipo($this->updir.$id.'.png');
> =A0 =A0 =A0 imagejpeg($immagine,null,100);
> =A0 =A0 =A0 imagedestroy($immagine);
> =A0 }
>
> If i commentize the "header" function i get a lot of strange simbols (suc=
h
> as the code of a jpeg image!) but no errors.
> The result of this code is a blank page. In Firefox the title sets to
> "picture.php (JPEG image)" and if i right-click it and click on
> "Proprieties" i get "0px =D7 0px (resized as 315px =D7 19px)".
>
> P.S.: I get the same result when I write $immagine =3D
> imagecreatefromjpeg(...)
>
> (Sorry for my english)
>
> Thanks in advance,
> Alfio.
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>



--=20
Martin Scotta

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

Re: [GD] Image errors

am 14.07.2009 18:30:38 von Ashley Sheridan

On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
> $immagine =3D $tipo($this->updir.$id.'.png');
>=20
> $tipo is undefined
>=20
>=20
> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
> volante wrote:
> > Hi to all
> >
> > I get a problem processing an image with GD libraries.
> >
> > This is my function
> >
> > public function showPicture($id) {
> > header('Content-type: image/jpeg');
> > $mime =3D mime_content_type($this->updir.$id.'.png');
> > $type =3D explode('/',$mime);
> > $type =3D 'imagecreatefrom'.$type[1];
> > $immagine =3D $tipo($this->updir.$id.'.png');
> > imagejpeg($immagine,null,100);
> > imagedestroy($immagine);
> > }
> >
> > If i commentize the "header" function i get a lot of strange simbols (s=
uch
> > as the code of a jpeg image!) but no errors.
> > The result of this code is a blank page. In Firefox the title sets to
> > "picture.php (JPEG image)" and if i right-click it and click on
> > "Proprieties" i get "0px × 0px (resized as 315px × 19px)".
> >
> > P.S.: I get the same result when I write $immagine =3D
> > imagecreatefromjpeg(...)
> >
> > (Sorry for my english)
> >
> > Thanks in advance,
> > Alfio.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
> >
>=20
>=20
>=20
> --=20
> Martin Scotta
>=20
Also, it doesn't look like you're actually doing anything with $type

Thanks
Ash
www.ashleysheridan.co.uk


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

Re: [GD] Image errors

am 14.07.2009 18:41:14 von Martin Scotta

He is calling the function by variable

something like this

$func =3D 'var_dump';

$func( new Foo );

On Tue, Jul 14, 2009 at 1:30 PM, Ashley
Sheridan wrote:
> On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
>> $immagine =3D $tipo($this->updir.$id.'.png');
>>
>> $tipo is undefined
>>
>>
>> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
>> volante wrote:
>> > Hi to all
>> >
>> > I get a problem processing an image with GD libraries.
>> >
>> > This is my function
>> >
>> > =A0 public function showPicture($id) {
>> > =A0 =A0 =A0 header('Content-type: image/jpeg');
>> > =A0 =A0 =A0 $mime =3D mime_content_type($this->updir.$id.'.png');
>> > =A0 =A0 =A0 $type =3D explode('/',$mime);
>> > =A0 =A0 =A0 $type =3D 'imagecreatefrom'.$type[1];
>> > =A0 =A0 =A0 $immagine =3D $tipo($this->updir.$id.'.png');
>> > =A0 =A0 =A0 imagejpeg($immagine,null,100);
>> > =A0 =A0 =A0 imagedestroy($immagine);
>> > =A0 }
>> >
>> > If i commentize the "header" function i get a lot of strange simbols (=
such
>> > as the code of a jpeg image!) but no errors.
>> > The result of this code is a blank page. In Firefox the title sets to
>> > "picture.php (JPEG image)" and if i right-click it and click on
>> > "Proprieties" i get "0px =D7 0px (resized as 315px =D7 19px)".
>> >
>> > P.S.: I get the same result when I write $immagine =3D
>> > imagecreatefromjpeg(...)
>> >
>> > (Sorry for my english)
>> >
>> > Thanks in advance,
>> > Alfio.
>> >
>> > --
>> > PHP General Mailing List (http://www.php.net/)
>> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >
>> >
>>
>>
>>
>> --
>> Martin Scotta
>>
> Also, it doesn't look like you're actually doing anything with $type
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>



--=20
Martin Scotta

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

Re: [GD] Image errors

am 14.07.2009 18:48:05 von Ashley Sheridan

On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
> He is calling the function by variable
>=20
> something like this
>=20
> $func =3D 'var_dump';
>=20
> $func( new Foo );
>=20
> On Tue, Jul 14, 2009 at 1:30 PM, Ashley
> Sheridan wrote:
> > On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
> >> $immagine =3D $tipo($this->updir.$id.'.png');
> >>
> >> $tipo is undefined
> >>
> >>
> >> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
> >> volante wrote:
> >> > Hi to all
> >> >
> >> > I get a problem processing an image with GD libraries.
> >> >
> >> > This is my function
> >> >
> >> > public function showPicture($id) {
> >> > header('Content-type: image/jpeg');
> >> > $mime =3D mime_content_type($this->updir.$id.'.png');
> >> > $type =3D explode('/',$mime);
> >> > $type =3D 'imagecreatefrom'.$type[1];
> >> > $immagine =3D $tipo($this->updir.$id.'.png');
> >> > imagejpeg($immagine,null,100);
> >> > imagedestroy($immagine);
> >> > }
> >> >
> >> > If i commentize the "header" function i get a lot of strange simbols=
(such
> >> > as the code of a jpeg image!) but no errors.
> >> > The result of this code is a blank page. In Firefox the title sets t=
o
> >> > "picture.php (JPEG image)" and if i right-click it and click on
> >> > "Proprieties" i get "0px × 0px (resized as 315px × 19px)".
> >> >
> >> > P.S.: I get the same result when I write $immagine =3D
> >> > imagecreatefromjpeg(...)
> >> >
> >> > (Sorry for my english)
> >> >
> >> > Thanks in advance,
> >> > Alfio.
> >> >
> >> > --
> >> > PHP General Mailing List (http://www.php.net/)
> >> > To unsubscribe, visit: http://www.php.net/unsub.php
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Martin Scotta
> >>
> > Also, it doesn't look like you're actually doing anything with $type
> >
> > Thanks
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
>=20
>=20
>=20
> --=20
> Martin Scotta
>=20

Bottom post ;)

$type =3D explode('/',$mime);
$type =3D 'imagecreatefrom'.$type[1];

$immagine =3D $tipo($this->updir.$id.'.png');
imagejpeg($immagine,null,100);
imagedestroy($immagine);

I'm not sure you understood what I meant. line 2 above $type is assigned
to the string 'imagecreatefrom'.$type[1];

Now I assume that was to be used later in some sort of eval() statement,
but its never called again, so the line really does nothing.

Thanks
Ash
www.ashleysheridan.co.uk


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

Re: [GD] Image errors

am 14.07.2009 19:16:20 von Martin Scotta

On Tue, Jul 14, 2009 at 1:48 PM, Ashley
Sheridan wrote:
> On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
>> He is calling the function by variable
>>
>> something like this
>>
>> $func =3D 'var_dump';
>>
>> $func( new Foo );
>>
>> On Tue, Jul 14, 2009 at 1:30 PM, Ashley
>> Sheridan wrote:
>> > On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
>> >> $immagine =3D $tipo($this->updir.$id.'.png');
>> >>
>> >> $tipo is undefined
>> >>
>> >>
>> >> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
>> >> volante wrote:
>> >> > Hi to all
>> >> >
>> >> > I get a problem processing an image with GD libraries.
>> >> >
>> >> > This is my function
>> >> >
>> >> > =A0 public function showPicture($id) {
>> >> > =A0 =A0 =A0 header('Content-type: image/jpeg');
>> >> > =A0 =A0 =A0 $mime =3D mime_content_type($this->updir.$id.'.png');
>> >> > =A0 =A0 =A0 $type =3D explode('/',$mime);
>> >> > =A0 =A0 =A0 $type =3D 'imagecreatefrom'.$type[1];
>> >> > =A0 =A0 =A0 $immagine =3D $tipo($this->updir.$id.'.png');
>> >> > =A0 =A0 =A0 imagejpeg($immagine,null,100);
>> >> > =A0 =A0 =A0 imagedestroy($immagine);
>> >> > =A0 }
>> >> >
>> >> > If i commentize the "header" function i get a lot of strange simbol=
s (such
>> >> > as the code of a jpeg image!) but no errors.
>> >> > The result of this code is a blank page. In Firefox the title sets =
to
>> >> > "picture.php (JPEG image)" and if i right-click it and click on
>> >> > "Proprieties" i get "0px =D7 0px (resized as 315px =D7 19px)".
>> >> >
>> >> > P.S.: I get the same result when I write $immagine =3D
>> >> > imagecreatefromjpeg(...)
>> >> >
>> >> > (Sorry for my english)
>> >> >
>> >> > Thanks in advance,
>> >> > Alfio.
>> >> >
>> >> > --
>> >> > PHP General Mailing List (http://www.php.net/)
>> >> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Martin Scotta
>> >>
>> > Also, it doesn't look like you're actually doing anything with $type
>> >
>> > Thanks
>> > Ash
>> > www.ashleysheridan.co.uk
>> >
>> >
>>
>>
>>
>> --
>> Martin Scotta
>>
>
> Bottom post ;)
>
> $type =3D explode('/',$mime);
> $type =3D 'imagecreatefrom'.$type[1];
>
> $immagine =3D $tipo($this->updir.$id.'.png');
> imagejpeg($immagine,null,100);
> imagedestroy($immagine);
>
> I'm not sure you understood what I meant. line 2 above $type is assigned
> to the string 'imagecreatefrom'.$type[1];
>
> Now I assume that was to be used later in some sort of eval() statement,
> but its never called again, so the line really does nothing.
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>

Mmmm, No

$type =3D explode('/',$mime); # type is array
$type =3D 'imagecreatefrom'.$type[1]; # type is a string

He is actually re-assigning the var ussing the content of the var.
Sounds crazy, but I use this method a lot, it helps to keep the scope clean=
..

--=20
Martin Scotta
ps. "tipo" is "type" in Spanish

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

Re: [GD] Image errors

am 14.07.2009 19:20:07 von Ashley Sheridan

On Tue, 2009-07-14 at 14:16 -0300, Martin Scotta wrote:
> On Tue, Jul 14, 2009 at 1:48 PM, Ashley
> Sheridan wrote:
> > On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
> >> He is calling the function by variable
> >>
> >> something like this
> >>
> >> $func =3D 'var_dump';
> >>
> >> $func( new Foo );
> >>
> >> On Tue, Jul 14, 2009 at 1:30 PM, Ashley
> >> Sheridan wrote:
> >> > On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
> >> >> $immagine =3D $tipo($this->updir.$id.'.png');
> >> >>
> >> >> $tipo is undefined
> >> >>
> >> >>
> >> >> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
> >> >> volante wrote:
> >> >> > Hi to all
> >> >> >
> >> >> > I get a problem processing an image with GD libraries.
> >> >> >
> >> >> > This is my function
> >> >> >
> >> >> > public function showPicture($id) {
> >> >> > header('Content-type: image/jpeg');
> >> >> > $mime =3D mime_content_type($this->updir.$id.'.png');
> >> >> > $type =3D explode('/',$mime);
> >> >> > $type =3D 'imagecreatefrom'.$type[1];
> >> >> > $immagine =3D $tipo($this->updir.$id.'.png');
> >> >> > imagejpeg($immagine,null,100);
> >> >> > imagedestroy($immagine);
> >> >> > }
> >> >> >
> >> >> > If i commentize the "header" function i get a lot of strange simb=
ols (such
> >> >> > as the code of a jpeg image!) but no errors.
> >> >> > The result of this code is a blank page. In Firefox the title set=
s to
> >> >> > "picture.php (JPEG image)" and if i right-click it and click on
> >> >> > "Proprieties" i get "0px × 0px (resized as 315px × 19px=
)".
> >> >> >
> >> >> > P.S.: I get the same result when I write $immagine =3D
> >> >> > imagecreatefromjpeg(...)
> >> >> >
> >> >> > (Sorry for my english)
> >> >> >
> >> >> > Thanks in advance,
> >> >> > Alfio.
> >> >> >
> >> >> > --
> >> >> > PHP General Mailing List (http://www.php.net/)
> >> >> > To unsubscribe, visit: http://www.php.net/unsub.php
> >> >> >
> >> >> >
> >> >>
> >> >>
> >> >>
> >> >> --
> >> >> Martin Scotta
> >> >>
> >> > Also, it doesn't look like you're actually doing anything with $type
> >> >
> >> > Thanks
> >> > Ash
> >> > www.ashleysheridan.co.uk
> >> >
> >> >
> >>
> >>
> >>
> >> --
> >> Martin Scotta
> >>
> >
> > Bottom post ;)
> >
> > $type =3D explode('/',$mime);
> > $type =3D 'imagecreatefrom'.$type[1];
> >
> > $immagine =3D $tipo($this->updir.$id.'.png');
> > imagejpeg($immagine,null,100);
> > imagedestroy($immagine);
> >
> > I'm not sure you understood what I meant. line 2 above $type is assigne=
d
> > to the string 'imagecreatefrom'.$type[1];
> >
> > Now I assume that was to be used later in some sort of eval() statement=
,
> > but its never called again, so the line really does nothing.
> >
> > Thanks
> > Ash
> > www.ashleysheridan.co.uk
> >
> >
>=20
> Mmmm, No
>=20
> $type =3D explode('/',$mime); # type is array
> $type =3D 'imagecreatefrom'.$type[1]; # type is a string
>=20
> He is actually re-assigning the var ussing the content of the var.
> Sounds crazy, but I use this method a lot, it helps to keep the scope cle=
an.
>=20

It's not crazy, I do it a lot, but he *does nothing with it* after that,
and the scope of the variable is limited to the function.

Thanks
Ash
www.ashleysheridan.co.uk


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

Re: [GD] Image errors

am 14.07.2009 19:25:54 von Martin Scotta

Why are you ussing GD?
All you need is output the image to the browser?

try this... I didn't test/run this code, but it may work...

public function showPicture( $id ) {
header('Content-type:' . mime_content_type( $this->updir . $id .
'.png' ) );
readfile( $this->updir . $id . '.png' );
}

hey, look, just 2 lines!

On Tue, Jul 14, 2009 at 2:20 PM, Ashley
Sheridan wrote:
> On Tue, 2009-07-14 at 14:16 -0300, Martin Scotta wrote:
>> On Tue, Jul 14, 2009 at 1:48 PM, Ashley
>> Sheridan wrote:
>> > On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
>> >> He is calling the function by variable
>> >>
>> >> something like this
>> >>
>> >> $func =3D 'var_dump';
>> >>
>> >> $func( new Foo );
>> >>
>> >> On Tue, Jul 14, 2009 at 1:30 PM, Ashley
>> >> Sheridan wrote:
>> >> > On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
>> >> >> $immagine =3D $tipo($this->updir.$id.'.png');
>> >> >>
>> >> >> $tipo is undefined
>> >> >>
>> >> >>
>> >> >> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
>> >> >> volante wrote:
>> >> >> > Hi to all
>> >> >> >
>> >> >> > I get a problem processing an image with GD libraries.
>> >> >> >
>> >> >> > This is my function
>> >> >> >
>> >> >> > =A0 public function showPicture($id) {
>> >> >> > =A0 =A0 =A0 header('Content-type: image/jpeg');
>> >> >> > =A0 =A0 =A0 $mime =3D mime_content_type($this->updir.$id.'.png')=
;
>> >> >> > =A0 =A0 =A0 $type =3D explode('/',$mime);
>> >> >> > =A0 =A0 =A0 $type =3D 'imagecreatefrom'.$type[1];
>> >> >> > =A0 =A0 =A0 $immagine =3D $tipo($this->updir.$id.'.png');
>> >> >> > =A0 =A0 =A0 imagejpeg($immagine,null,100);
>> >> >> > =A0 =A0 =A0 imagedestroy($immagine);
>> >> >> > =A0 }
>> >> >> >
>> >> >> > If i commentize the "header" function i get a lot of strange sim=
bols (such
>> >> >> > as the code of a jpeg image!) but no errors.
>> >> >> > The result of this code is a blank page. In Firefox the title se=
ts to
>> >> >> > "picture.php (JPEG image)" and if i right-click it and click on
>> >> >> > "Proprieties" i get "0px =D7 0px (resized as 315px =D7 19px)".
>> >> >> >
>> >> >> > P.S.: I get the same result when I write $immagine =3D
>> >> >> > imagecreatefromjpeg(...)
>> >> >> >
>> >> >> > (Sorry for my english)
>> >> >> >
>> >> >> > Thanks in advance,
>> >> >> > Alfio.
>> >> >> >
>> >> >> > --
>> >> >> > PHP General Mailing List (http://www.php.net/)
>> >> >> > To unsubscribe, visit: http://www.php.net/unsub.php
>> >> >> >
>> >> >> >
>> >> >>
>> >> >>
>> >> >>
>> >> >> --
>> >> >> Martin Scotta
>> >> >>
>> >> > Also, it doesn't look like you're actually doing anything with $typ=
e
>> >> >
>> >> > Thanks
>> >> > Ash
>> >> > www.ashleysheridan.co.uk
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> Martin Scotta
>> >>
>> >
>> > Bottom post ;)
>> >
>> > $type =3D explode('/',$mime);
>> > $type =3D 'imagecreatefrom'.$type[1];
>> >
>> > $immagine =3D $tipo($this->updir.$id.'.png');
>> > imagejpeg($immagine,null,100);
>> > imagedestroy($immagine);
>> >
>> > I'm not sure you understood what I meant. line 2 above $type is assign=
ed
>> > to the string 'imagecreatefrom'.$type[1];
>> >
>> > Now I assume that was to be used later in some sort of eval() statemen=
t,
>> > but its never called again, so the line really does nothing.
>> >
>> > Thanks
>> > Ash
>> > www.ashleysheridan.co.uk
>> >
>> >
>>
>> Mmmm, No
>>
>> $type =3D explode('/',$mime); # type is array
>> $type =3D 'imagecreatefrom'.$type[1]; # type is a string
>>
>> He is actually re-assigning the var ussing the content of the var.
>> Sounds crazy, but I use this method a lot, it helps to keep the scope cl=
ean.
>>
>
> It's not crazy, I do it a lot, but he *does nothing with it* after that,
> and the scope of the variable is limited to the function.
>
> Thanks
> Ash
> www.ashleysheridan.co.uk
>
>



--=20
Martin Scotta

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

Re: [GD] Image errors

am 15.07.2009 11:50:32 von Peter Ford

Ash, Martin,

Seems you are both wandering around the obvious problem...

I suspect that $tipo (in the next line) is *supposed* to be $type - sounds like
a partial Italian translation to me...

So given that $type="imagecreatefrompng" (for example, if the mime check returns
'png' - not very reliable, I suspect),

then

$immagine = $type($this->updir.$id.'.png')

should create a GD resource from the file, but the image appears to be empty.

My take on this is:

OP says he gets the same result from
$immagine = imagecreatefromjpeg(this->updir.$id.'.png')

- well I might expect to get an error message if I loaded a PNG expecting it to
be a JPEG, but I certainly wouldn't expect an image.

On some basic tests, I find that mime_content_type() is not defined on my
system, so ignoring that and trying to load a PNG file using imagecreatefromjpeg
results in pretty much the same result as the OP...

Conclusions:

First: if you use Italian for your variable names, don't change half of their
instances to English...

Second: Make sure you actually know the mime type of a file before you try to
load it into GD...

My version of this would test against known image types to try the GD function:

foreach (Array('png','jpeg','gif') as $typeName)
{
$type = 'imagecreatefrom'.$typeName;
$immagine = $type(this->updir.$id.'.png'le);
if (is_resource($immagine))
{
header('Content-type: image/jpeg');
imagejpeg($immagine,null,100);
imagedestroy($immagine);
break;
}
}
header('HTTP/1.0 500 File is not an allowed image type');





--
Peter Ford phone: 01580 893333
Developer fax: 01580 893399
Justcroft International Ltd., Staplehurst, Kent

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

Re: [GD] Image errors

am 15.07.2009 11:52:02 von Peter Ford

Martin Scotta wrote:
> Why are you ussing GD?
> All you need is output the image to the browser?
>
> try this... I didn't test/run this code, but it may work...
>
> public function showPicture( $id ) {
> header('Content-type:' . mime_content_type( $this->updir . $id .
> '.png' ) );
> readfile( $this->updir . $id . '.png' );
> }
>
> hey, look, just 2 lines!
>
But it doesn't convert the image from whatever came in to a JPEG output, which
is what the OP's code appears to be trying to do (and possibly ought to work...)



--
Peter Ford phone: 01580 893333
Developer fax: 01580 893399
Justcroft International Ltd., Staplehurst, Kent

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