By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,637 Members | 3,680 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,637 IT Pros & Developers. It's quick & easy.

Problems with GD, Version Incompatibilities

P: n/a
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.

Jul 17 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
replace "imagecreatetruecolor" with "imagecreate" and
"imagecopyresampled" with "imagecopyresized"

that should work.

sanjay

"Konman" <ko********@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.
|
|
|
Jul 17 '05 #2

P: n/a
"s a n j a y" <so*****@somewhere.com> wrote in message
news:A%*******************@newssrv26.news.prodigy. com...
"Konman" <ko********@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.

replace "imagecreatetruecolor" with "imagecreate" and
"imagecopyresampled" with "imagecopyresized"

that should work.

sanjay


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
Jul 17 '05 #3

P: n/a
Thank You

Works great.
Konman

"s a n j a y" <so*****@somewhere.com> wrote in message
news:A%*******************@newssrv26.news.prodigy. com...
replace "imagecreatetruecolor" with "imagecreate" and
"imagecopyresampled" with "imagecopyresized"

that should work.

sanjay

"Konman" <ko********@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.
|
|
|

Jul 17 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.