Re: [PHP] GD lib not working
On Sunday 05 December 2004 17:37, Dade Register wrote: It seems that my install of php does not like the GD library. I've tried everything, and read past forum messages. Here's what I'm running: FreeBSD 5.2.1 Apache 2.0.52 Php 5.0.2 GD 2.0.32 Php compiles fine, and even the tests pass for the GD lib, but any GD function fails including gdinfo() and imagecreate. Fatal error: Call to undefined function imagecreate(). I need some help. Anyone have any ideas? Thanx. Is this a new installation? A re-installation? An upgrade? Did you restart apache? Does phpinfo() show: (i) that the ./configure command was indeed that one that you used? (ii) that you have a GD section showing GD info? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* People don't usually make the same mistake twice -- they make it three times, four time, five times... */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD lib not working
It's a new installation. I did restart Apache after re-compiling PHP. phpinfo() shows my config command I used is: ./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/usr/local/mysql' '--with-zlib-dir=/usr/local/lib' '--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib' '--with-png-dir=/usr/local/lib' '--with-libxml-dir=/usr/local/lib' '--with-iconv-dir=/usr/local/lib' '--with-gd-dir=/usr/local/lib' '--without-xpm' '--enable-gd-native-ttf' '--enable-exif' '--enable-ftp' phpinfo does not show a gd section. I'm assuming that's why it doesn't work. Am I compiling it wrong? I verified that all my libs are located @ /usr/local/lib. -Dade Jason Wong [EMAIL PROTECTED] wrote: On Sunday 05 December 2004 17:37, Dade Register wrote: It seems that my install of php does not like the GD library. I've tried everything, and read past forum messages. Here's what I'm running: FreeBSD 5.2.1 Apache 2.0.52 Php 5.0.2 GD 2.0.32 Php compiles fine, and even the tests pass for the GD lib, but any GD function fails including gdinfo() and imagecreate. Fatal error: Call to undefined function imagecreate(). I need some help. Anyone have any ideas? Thanx. Is this a new installation? A re-installation? An upgrade? Did you restart apache? Does phpinfo() show: (i) that the ./configure command was indeed that one that you used? (ii) that you have a GD section showing GD info? -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* People don't usually make the same mistake twice -- they make it three times, four time, five times... */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php - Do you Yahoo!? Yahoo! Mail - Helps protect you from nasty viruses.
Re: [PHP] GD lib not working
Please do not top post. On Monday 06 December 2004 00:22, Dade Register wrote: It's a new installation. I did restart Apache after re-compiling PHP. phpinfo() shows my config command I used is: ./configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql=/usr/local/mysql' '--with-zlib-dir=/usr/local/lib' '--with-jpeg-dir=/usr/local/lib' '--with-freetype-dir=/usr/local/lib' '--with-png-dir=/usr/local/lib' '--with-libxml-dir=/usr/local/lib' '--with-iconv-dir=/usr/local/lib' '--with-gd-dir=/usr/local/lib' '--without-xpm' '--enable-gd-native-ttf' '--enable-exif' '--enable-ftp' '--with-gd-dir=/usr/local/lib' should be '--with-gd=/usr/local/lib' An annoyance (or gotcha) with PHP's ./configure command is that it does not warn you if you use totally bogus options, eg: ./configure --with-super-thingamajit will happily make and install with no errors or warnings. -- Jason Wong - Gremlins Associates - www.gremlins.biz Open Source Software Systems Integrators * Web Design Hosting * Internet Intranet Applications Development * -- Search the list archives before you post http://marc.theaimsgroup.com/?l=php-general -- /* In my end is my beginning. -- Mary Stuart, Queen of Scots */ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Gd Lib PHP.4.3.2 Gentoo
I change system from apach2 to apache it fixed... Sancar Saran -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GD lib. image quality!
imageCreate will create an image, but its palette will be very limited, so when you try to copy your photo onto it, it will maintain the palette of the original picture. Obviously, this is not what you want, since the picture comes out looking all grey and faded (probably 8-16 colors!). What works for me is creating a blank image using imageCreate(), then saving it as a temporary jpeg (using imageJpeg). This action will set the palette of the image to a jpeg's palette (close to 16-bit or better colorspace). If you imageCopyResized over this temp.jpg (which you need to create whenever you run the script to ensure sizing is perfect), it will come out with the full palette of colors. Pseudo code: ? $dest_h = whatever your calculated destination height is; $dest_w = whatever your calculated destination width is; $src_h = height of original image; $src_w = width of original image; // create the blank limited-palette image $base_image = imageCreate($dest_w, $dest_h); // convert and save it to temp.jpg imagejpeg($base_image, 'path/to/temp.jpg'); // get the image pointer to the temp jpeg $image = imageCreateFromJpeg('path/to/temp.jpg'); // get the image pointer to the original image $imageToResize = imageCreateFromJpeg('path/to/image_to_be_resized.jpg'); // resize the original image over temp.jpg // since you have GD2, you could also use imageCopyResampled imageCopyResized($image, $imageToResize, 0, 0, 0, 0, $dest_w, $dest_h, $src_w, $src_h); // values for output jpeg quality $jpegQuality = 75; // create the resized image imageJpeg($image, 'path/to/thumbnail_name.jpg', $jpegQuality); ? Then all you have to do is a little cleanup with imageDestroy() and you should have a nice looking thumbnail! I usually add a line like this to the script to make sure everything went smoothly: ? echo 'htmlheadtitleThumbnail Generator/title' .'/headbodyimg src=path/to/thumbnail_name.jpg' .'/body/html'; ? It lets me see the quality of the thumbnail the second the script completes. Try it - you'll get perfect thumbnails every time. I used this technique for all of the pictures at www.arkestraclandestina.com with GD1.6 - and all of them actually had custom color profiles! Works like a charm. I like this method because I can be sure that the script won't break on sites with older PHP and GD versions - which is an important consideration when you're deploying applications to other sites... However! If you are sure it will only be run on a PHP4, GD2 system, you can avoid all of the temp jpg madness altogether by just altering your code to use imageCreateTrueColor() instead of imageCreate()!! ;P Easy as pie! Dave -Original Message- From: Arcadius A. [mailto:[EMAIL PROTECTED]] Sent: Sunday, August 25, 2002 4:11 AM To: [EMAIL PROTECTED] Subject: [PHP] GD lib. image quality! Hello! I wrote a little script for generation thumbnails of larger images code $origImage = imageCreateFromJpeg($sourcePath./.$currentImageName); $thumbnail = imageCreate($thumbWidth,$thumbHeight);// create empty image imageCopyResized($thumbnail,$origImage,0,0,0,0,$thumbWidth,$thumbHeight,imag esX($origImage),imagesY($origImage)); imageJpeg($thumbnail, $targetPath./.$thumbNamePrefix._thumb.jpg); // Store it imageDestroy($thumbnail); // cleanup echo brImage .$targetPath./.$thumbNamePrefix._thumb.jpg. created successfully!; /code then, I've noticed that the quality of the thumbnails created is very bad! my phpinfo() page shows 2.0 or higher as GD version So, I'm wondering whether I'm doing something wrong in my code or whether there exist a better library to use with PHP ... a library able to generate good quality JPG files... Thanks in advance. Arcadius. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GD lib. image quality!
If you have GD2 I'd advise using imagecopyresampled, as I found using imagecopyresized often resulted in blue or grayish images, while imagecopyresampled resulted in normal looking images. Jason Reid [EMAIL PROTECTED] -- AC Host Canada www.achost.ca - Original Message - From: Dave at Sinewaves.net [EMAIL PROTECTED] To: Arcadius A. [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, August 25, 2002 12:23 PM Subject: RE: [PHP] GD lib. image quality! imageCreate will create an image, but its palette will be very limited, so when you try to copy your photo onto it, it will maintain the palette of the original picture. Obviously, this is not what you want, since the picture comes out looking all grey and faded (probably 8-16 colors!). What works for me is creating a blank image using imageCreate(), then saving it as a temporary jpeg (using imageJpeg). This action will set the palette of the image to a jpeg's palette (close to 16-bit or better colorspace). If you imageCopyResized over this temp.jpg (which you need to create whenever you run the script to ensure sizing is perfect), it will come out with the full palette of colors. Pseudo code: ? $dest_h = whatever your calculated destination height is; $dest_w = whatever your calculated destination width is; $src_h = height of original image; $src_w = width of original image; // create the blank limited-palette image $base_image = imageCreate($dest_w, $dest_h); // convert and save it to temp.jpg imagejpeg($base_image, 'path/to/temp.jpg'); // get the image pointer to the temp jpeg $image = imageCreateFromJpeg('path/to/temp.jpg'); // get the image pointer to the original image $imageToResize = imageCreateFromJpeg('path/to/image_to_be_resized.jpg'); // resize the original image over temp.jpg // since you have GD2, you could also use imageCopyResampled imageCopyResized($image, $imageToResize, 0, 0, 0, 0, $dest_w, $dest_h, $src_w, $src_h); // values for output jpeg quality $jpegQuality = 75; // create the resized image imageJpeg($image, 'path/to/thumbnail_name.jpg', $jpegQuality); ? Then all you have to do is a little cleanup with imageDestroy() and you should have a nice looking thumbnail! I usually add a line like this to the script to make sure everything went smoothly: ? echo 'htmlheadtitleThumbnail Generator/title' .'/headbodyimg src=path/to/thumbnail_name.jpg' .'/body/html'; ? It lets me see the quality of the thumbnail the second the script completes. Try it - you'll get perfect thumbnails every time. I used this technique for all of the pictures at www.arkestraclandestina.com with GD1.6 - and all of them actually had custom color profiles! Works like a charm. I like this method because I can be sure that the script won't break on sites with older PHP and GD versions - which is an important consideration when you're deploying applications to other sites... However! If you are sure it will only be run on a PHP4, GD2 system, you can avoid all of the temp jpg madness altogether by just altering your code to use imageCreateTrueColor() instead of imageCreate()!! ;P Easy as pie! Dave -Original Message- From: Arcadius A. [mailto:[EMAIL PROTECTED]] Sent: Sunday, August 25, 2002 4:11 AM To: [EMAIL PROTECTED] Subject: [PHP] GD lib. image quality! Hello! I wrote a little script for generation thumbnails of larger images code $origImage = imageCreateFromJpeg($sourcePath./.$currentImageName); $thumbnail = imageCreate($thumbWidth,$thumbHeight);// create empty image imageCopyResized($thumbnail,$origImage,0,0,0,0,$thumbWidth,$thumbHeight,imag esX($origImage),imagesY($origImage)); imageJpeg($thumbnail, $targetPath./.$thumbNamePrefix._thumb.jpg); // Store it imageDestroy($thumbnail); // cleanup echo brImage .$targetPath./.$thumbNamePrefix._thumb.jpg. created successfully!; /code then, I've noticed that the quality of the thumbnails created is very bad! my phpinfo() page shows 2.0 or higher as GD version So, I'm wondering whether I'm doing something wrong in my code or whether there exist a better library to use with PHP ... a library able to generate good quality JPG files... Thanks in advance. Arcadius. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GD lib. image quality!
imagecopyresize() just skips pixels in order to reduce it in size. imagecopyresampled() will take the average of adjacent pixels and therefore produce a much better scaled down image. -Rasmus On Sun, 25 Aug 2002, Jason Reid wrote: If you have GD2 I'd advise using imagecopyresampled, as I found using imagecopyresized often resulted in blue or grayish images, while imagecopyresampled resulted in normal looking images. Jason Reid [EMAIL PROTECTED] -- AC Host Canada www.achost.ca - Original Message - From: Dave at Sinewaves.net [EMAIL PROTECTED] To: Arcadius A. [EMAIL PROTECTED]; [EMAIL PROTECTED] Sent: Sunday, August 25, 2002 12:23 PM Subject: RE: [PHP] GD lib. image quality! imageCreate will create an image, but its palette will be very limited, so when you try to copy your photo onto it, it will maintain the palette of the original picture. Obviously, this is not what you want, since the picture comes out looking all grey and faded (probably 8-16 colors!). What works for me is creating a blank image using imageCreate(), then saving it as a temporary jpeg (using imageJpeg). This action will set the palette of the image to a jpeg's palette (close to 16-bit or better colorspace). If you imageCopyResized over this temp.jpg (which you need to create whenever you run the script to ensure sizing is perfect), it will come out with the full palette of colors. Pseudo code: ? $dest_h = whatever your calculated destination height is; $dest_w = whatever your calculated destination width is; $src_h = height of original image; $src_w = width of original image; // create the blank limited-palette image $base_image = imageCreate($dest_w, $dest_h); // convert and save it to temp.jpg imagejpeg($base_image, 'path/to/temp.jpg'); // get the image pointer to the temp jpeg $image = imageCreateFromJpeg('path/to/temp.jpg'); // get the image pointer to the original image $imageToResize = imageCreateFromJpeg('path/to/image_to_be_resized.jpg'); // resize the original image over temp.jpg // since you have GD2, you could also use imageCopyResampled imageCopyResized($image, $imageToResize, 0, 0, 0, 0, $dest_w, $dest_h, $src_w, $src_h); // values for output jpeg quality $jpegQuality = 75; // create the resized image imageJpeg($image, 'path/to/thumbnail_name.jpg', $jpegQuality); ? Then all you have to do is a little cleanup with imageDestroy() and you should have a nice looking thumbnail! I usually add a line like this to the script to make sure everything went smoothly: ? echo 'htmlheadtitleThumbnail Generator/title' .'/headbodyimg src=path/to/thumbnail_name.jpg' .'/body/html'; ? It lets me see the quality of the thumbnail the second the script completes. Try it - you'll get perfect thumbnails every time. I used this technique for all of the pictures at www.arkestraclandestina.com with GD1.6 - and all of them actually had custom color profiles! Works like a charm. I like this method because I can be sure that the script won't break on sites with older PHP and GD versions - which is an important consideration when you're deploying applications to other sites... However! If you are sure it will only be run on a PHP4, GD2 system, you can avoid all of the temp jpg madness altogether by just altering your code to use imageCreateTrueColor() instead of imageCreate()!! ;P Easy as pie! Dave -Original Message- From: Arcadius A. [mailto:[EMAIL PROTECTED]] Sent: Sunday, August 25, 2002 4:11 AM To: [EMAIL PROTECTED] Subject: [PHP] GD lib. image quality! Hello! I wrote a little script for generation thumbnails of larger images code $origImage = imageCreateFromJpeg($sourcePath./.$currentImageName); $thumbnail = imageCreate($thumbWidth,$thumbHeight);// create empty image imageCopyResized($thumbnail,$origImage,0,0,0,0,$thumbWidth,$thumbHeight,imag esX($origImage),imagesY($origImage)); imageJpeg($thumbnail, $targetPath./.$thumbNamePrefix._thumb.jpg); // Store it imageDestroy($thumbnail); // cleanup echo brImage .$targetPath./.$thumbNamePrefix._thumb.jpg. created successfully!; /code then, I've noticed that the quality of the thumbnails created is very bad! my phpinfo() page shows 2.0 or higher as GD version So, I'm wondering whether I'm doing something wrong in my code or whether there exist a better library to use with PHP ... a library able to generate good quality JPG files... Thanks in advance. Arcadius. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] GD Lib
Hi there; I installed Apache2.0.39 and PHP4.2.1 on RedHat Linux 7.2. The installation procedure is fine. The php installation inlcude gd and some extension, but I can't find the php-gd.so on my computer. Anybody can help? Looks like the problem is that you haven't installed GD. Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD Lib
Hi Dave: I have gd installed and now the configure, make and make install are working fine. but aftere installation, I can't find any extension there. Yang Dave Macrae [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi there; I installed Apache2.0.39 and PHP4.2.1 on RedHat Linux 7.2. The installation procedure is fine. The php installation inlcude gd and some extension, but I can't find the php-gd.so on my computer. Anybody can help? Looks like the problem is that you haven't installed GD. Dave -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] GD Lib
Are you compiling php with the --with-gd=shared option? Personally (Solaris 8, gcc 2.95.3 , php 4.1.1 and later) I've never been able to get the gd shared object to work (gd.so load errors), so I've always ended up compiling it into PHP. -steve At 1:23 PM -0400 7/9/02, Yang wrote: Hi Dave: I have gd installed and now the configure, make and make install are working fine. but aftere installation, I can't find any extension there. Yang Dave Macrae [EMAIL PROTECTED] wrote in message [EMAIL PROTECTED]">news:[EMAIL PROTECTED]... Hi there; I installed Apache2.0.39 and PHP4.2.1 on RedHat Linux 7.2. The installation procedure is fine. The php installation inlcude gd and some extension, but I can't find the php-gd.so on my computer. Anybody can help? Looks like the problem is that you haven't installed GD. Dave -- ++ | Steve Edberg [EMAIL PROTECTED] | | University of California, Davis (530)754-9127 | | Programming/Database/SysAdmin http://pgfsun.ucdavis.edu/ | ++ | The end to politics as usual: | | The Monster Raving Loony Party (http://www.omrlp.com/) | ++ -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] gd-lib and libjpeg issues
On Thu, 15 Nov 2001 05:29, Bill Brennick wrote: Hi all... Having an issue with PHP recognizing the libgd and libjpeg libraries... I specifically downloaded the newest version(s) of those, and compiled the PHP 4.0.6 with: ./configure --with-mysql=/usr/local/mysql --with-apache=../apache_1.3.22 --with-xml --with-zlib --with-gd=/usr/lib --with-jpeg-dir=/usr/lib --with-png-dir=/usr/lib However, I still keep getting the following message everytime I use an app that uses GD (For example, jpgraph) Your PHP (and GD-lib) installation does not appear to support any known graphic formats.You need to first make sure GD is compiled as a module to PHP. If you also want to use JPEG images you must get the JPEG library. Please see the PHP docs for details. Have looked into everything: php.ini's, apache config's, etc... At a loss... Thanks... - Bill Rasmus posted this suggesation a while back - it worked for me. Has anyone got PHP successfully compiled and using GD 2.0.1? If so what was your configure line please and any other changes you had to make in order to get PHP to compile. Thanks. Build gd-2.0.1 with these two lines in your GD2 Makefile: CFLAGS=-g -DHAVE_LIBPNG -DHAVE_LIBJPEG -DHAVE_LIBFREETYPE LIBS=libgd.a -lpng -lz -ljpeg -lfreetype -lm Don't install the lib anywhere, just leave them in the gd-2.0.1 directory. Then build PHP using: --with-gd=/home/your_dir/gd-2.0.1 --with-freetype-dir=/usr --enable-gd-native-ttf (note there was a typo in 4.0.6 on this one) use: --enable-gd-native-tt if you are using 4.0.6 --enable-gd-imgstrttf --with-jpeg-dir=/usr --with-png-dir=/usr --with-xpm-dir=/usr/X11R6 This assumes that you have freetype2 installed along with the libjpeg and libpng libs under /usr -Rasmus Keep an eye on the output of configure as sometimes you'll see messages in there about the image libs - but the absence of same even if specified doesn't seem to crash the compilation. -- David Robley Techno-JoaT, Web Maintainer, Mail List Admin, etc CENTRE FOR INJURY STUDIES Flinders University, SOUTH AUSTRALIA And now for something completely the same... -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]
Re: [PHP] gd lib question.
Just a quick question for anyone that uses GD-Lib prior to the latest true-colo(u)r version (specifically v. 1.6.1) - if I try to load a jpeg that has more than 256 colours in it, will it succeed? I know the obvious answer is to try it and see...but I don't have it here on my machine, and I don't want to retrofit it just to test this one thing out! Yes, it will work but it will dither it down to 256 colours. -Rasmus -- PHP General Mailing List (http://www.php.net/) To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED] To contact the list administrators, e-mail: [EMAIL PROTECTED]