Problems with GD, Version Incompatibilities 
July 17th, 2005, 12:30 AM
| | | Problems with GD, Version Incompatibilities
I am new to php and have run into one problem with one of the scripts I have
found and I am unsure of how to correct the problem.
My Web Host is currently running PHP Version 4.1.2 and PHP Info returns the
following information for the GD module.
GD Support enabled
GD Version 1.6.2 or higher
FreeType Support enabled
FreeType Linkage with freetype
JPG Support enabled
PNG Support enabled
WBMP Support enabled
The problem is the script I am using has functions used in it that were not
available in this version of GD. Here is the code for the script.
$src = imagecreatefromjpeg("$image");
$im = imagecreatetruecolor($newwidth,$newheight);
imagecopyresampled($im,$src,0,0,0,0,$newwidth,$new height,$width,$height);
imagejpeg($im, '',85);
imagedestroy($im);
From what I have been able to find out.
The following two functions were not available until GD 2.0
imagecreatetruecolor
imagecopyresampled
And imagejpeg Requires GD 1.8
Any suggestions on how to rewrite this script to use the older GD 1.6.2?
This code is used to create all of the thumb nails dynamically. I had the
entire site ready to go online and tested on my home system running Apache
and PHP 4.3.3 and once it was uploaded the gallery stopped working..
Any help would be greatly appreciated. | 
July 17th, 2005, 12:30 AM
| | | Re: Problems with GD, Version Incompatibilities
replace "imagecreatetruecolor" with "imagecreate" and
"imagecopyresampled" with "imagecopyresized"
that should work.
sanjay
"Konman" <konman_2k3@yahoo.com> wrote in message
news:Xemib.6829$x97.5961@clgrps13...
| I am new to php and have run into one problem with one of the scripts I
have
| found and I am unsure of how to correct the problem.
|
| My Web Host is currently running PHP Version 4.1.2 and PHP Info returns
the
| following information for the GD module.
|
| GD Support enabled
| GD Version 1.6.2 or higher
| FreeType Support enabled
| FreeType Linkage with freetype
| JPG Support enabled
| PNG Support enabled
| WBMP Support enabled
|
|
| The problem is the script I am using has functions used in it that were
not
| available in this version of GD. Here is the code for the script.
|
|
| $src = imagecreatefromjpeg("$image");
| $im = imagecreatetruecolor($newwidth,$newheight);
| imagecopyresampled($im,$src,0,0,0,0,$newwidth,$new height,$width,$height);
| imagejpeg($im, '',85);
| imagedestroy($im);
|
| From what I have been able to find out.
|
| The following two functions were not available until GD 2.0
|
| imagecreatetruecolor
| imagecopyresampled
|
| And imagejpeg Requires GD 1.8
|
| Any suggestions on how to rewrite this script to use the older GD 1.6.2?
| This code is used to create all of the thumb nails dynamically. I had the
| entire site ready to go online and tested on my home system running Apache
| and PHP 4.3.3 and once it was uploaded the gallery stopped working..
|
| Any help would be greatly appreciated.
|
|
| | 
July 17th, 2005, 12:30 AM
| | | Re: Problems with GD, Version Incompatibilities
"s a n j a y" <someone@somewhere.com> wrote in message
news:A%mib.1345$8x2.585505@newssrv26.news.prodigy. com...[color=blue]
> "Konman" <konman_2k3@yahoo.com> wrote in message
> news:Xemib.6829$x97.5961@clgrps13...
> | I am new to php and have run into one problem with one of the scripts I
> have
> | found and I am unsure of how to correct the problem.
> |
> | My Web Host is currently running PHP Version 4.1.2 and PHP Info returns
> the
> | following information for the GD module.
> |
> | GD Support enabled
> | GD Version 1.6.2 or higher
> | FreeType Support enabled
> | FreeType Linkage with freetype
> | JPG Support enabled
> | PNG Support enabled
> | WBMP Support enabled
> |
> |
> | The problem is the script I am using has functions used in it that were
> not
> | available in this version of GD. Here is the code for the script.
> |
> |
> | $src = imagecreatefromjpeg("$image");
> | $im = imagecreatetruecolor($newwidth,$newheight);
> |[/color]
imagecopyresampled($im,$src,0,0,0,0,$newwidth,$new height,$width,$height);[color=blue]
> | imagejpeg($im, '',85);
> | imagedestroy($im);
> |
> | From what I have been able to find out.
> |
> | The following two functions were not available until GD 2.0
> |
> | imagecreatetruecolor
> | imagecopyresampled
> |
> | And imagejpeg Requires GD 1.8
> |
> | Any suggestions on how to rewrite this script to use the older GD 1.6.2?
> | This code is used to create all of the thumb nails dynamically. I had[/color]
the[color=blue]
> | entire site ready to go online and tested on my home system running[/color]
Apache[color=blue]
> | and PHP 4.3.3 and once it was uploaded the gallery stopped working..
> |
> | Any help would be greatly appreciated.
>
> replace "imagecreatetruecolor" with "imagecreate" and
> "imagecopyresampled" with "imagecopyresized"
>
> that should work.
>
> sanjay[/color]
However, you need to know that imagecreate and imagecreatetruecolor are
different and will only result in a 256 color, paletted image being created,
even with a JPEG. Imagecopyresized is also a non-aliased version of
imagecopyresampled and the thumbnails will therefore look very pixelated.
There is a user contributed function on php.net that provides bicubic
resampling and that generates an aliased version. The result is a lot better
than imagecopyresized but the processing load is intensive.
If you're a quality freak; you may want to consider thumbnailing on your
local computer instead or getting a different host as the whole PHP 4.1.2
environment seems to indicate to me that the host is not keeping up to date
and not providing a comparable service to others out there. There are a lot
of very useful features in PHP 4.3.x and I personally find it very difficult
to develop for pre-4.3.0 environments and don't usually even try.
Paulus | 
July 17th, 2005, 12:30 AM
| | | Re: Problems with GD, Version Incompatibilities
Thank You
Works great.
Konman
"s a n j a y" <someone@somewhere.com> wrote in message
news:A%mib.1345$8x2.585505@newssrv26.news.prodigy. com...[color=blue]
> replace "imagecreatetruecolor" with "imagecreate" and
> "imagecopyresampled" with "imagecopyresized"
>
> that should work.
>
> sanjay
>
>
>
> "Konman" <konman_2k3@yahoo.com> wrote in message
> news:Xemib.6829$x97.5961@clgrps13...
> | I am new to php and have run into one problem with one of the scripts I
> have
> | found and I am unsure of how to correct the problem.
> |
> | My Web Host is currently running PHP Version 4.1.2 and PHP Info returns
> the
> | following information for the GD module.
> |
> | GD Support enabled
> | GD Version 1.6.2 or higher
> | FreeType Support enabled
> | FreeType Linkage with freetype
> | JPG Support enabled
> | PNG Support enabled
> | WBMP Support enabled
> |
> |
> | The problem is the script I am using has functions used in it that were
> not
> | available in this version of GD. Here is the code for the script.
> |
> |
> | $src = imagecreatefromjpeg("$image");
> | $im = imagecreatetruecolor($newwidth,$newheight);
> |[/color]
imagecopyresampled($im,$src,0,0,0,0,$newwidth,$new height,$width,$height);[color=blue]
> | imagejpeg($im, '',85);
> | imagedestroy($im);
> |
> | From what I have been able to find out.
> |
> | The following two functions were not available until GD 2.0
> |
> | imagecreatetruecolor
> | imagecopyresampled
> |
> | And imagejpeg Requires GD 1.8
> |
> | Any suggestions on how to rewrite this script to use the older GD 1.6.2?
> | This code is used to create all of the thumb nails dynamically. I had[/color]
the[color=blue]
> | entire site ready to go online and tested on my home system running[/color]
Apache[color=blue]
> | and PHP 4.3.3 and once it was uploaded the gallery stopped working..
> |
> | Any help would be greatly appreciated.
> |
> |
> |
>
>[/color] | | Thread Tools | Search this Thread | | | |
Posting Rules
| You may not post new threads You may not post replies You may not post attachments You may not edit your posts HTML code is Off | | | | | | What is Bytes?
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 220,989 network members.
|