Re: [GD] Image errors

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Tue, Jul 14, 2009 at 1:48 PM, Ashley
Sheridan<ash@xxxxxxxxxxxxxxxxxxxx> wrote:
> On Tue, 2009-07-14 at 13:41 -0300, Martin Scotta wrote:
>> He is calling the function by variable
>>
>> something like this
>>
>> $func = 'var_dump';
>>
>> $func( new Foo );
>>
>> On Tue, Jul 14, 2009 at 1:30 PM, Ashley
>> Sheridan<ash@xxxxxxxxxxxxxxxxxxxx> wrote:
>> > On Tue, 2009-07-14 at 13:27 -0300, Martin Scotta wrote:
>> >> $immagine = $tipo($this->updir.$id.'.png');
>> >>
>> >> $tipo is undefined
>> >>
>> >>
>> >> On Tue, Jul 14, 2009 at 12:48 PM, Il pinguino
>> >> volante<tuxsoul@xxxxxxxxxxxxx> 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 = 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
>> >> >
>> >> >
>> >>
>> >>
>> >>
>> >> --
>> >> 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 = explode('/',$mime);
> $type = 'imagecreatefrom'.$type[1];
>
> $immagine = $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 = explode('/',$mime); # type is array
$type = '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.

-- 
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



[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux