![]() |
the gd library for php
ok im confused about this whole gd library thing, i have php 4.3.0 and i read something about the gd library built in, is it on 4.3.0? if not how do i install it, i've been to the site and that was confusing too? also, can anyone give me an idea or a website on how to use it?
filburt's sig inspired this question :) |
A variation of GD2.0 is preinstalled with PHP 4.3.0
If you must check, you can create a PHP file with the following contents, and run it in your browser to check the GD status on your server: PHP Code:
|
If you plan on duplicating my idea beware that I have a cron job cache the stats every 15 minutes, mainly because it uses around five queries to create the image. If it did that every time somebody requested the image then it would kill the server.
|
so would it be better to go install the newest version of gd?
|
You're best off installing PHP 4.3.1 which includes the latest version of the GD library.
|
ok cool, thanks filburt
|
ok i have php 4.3.1 installed on my windows server, but if i try to use ImageCreateFromPng i get an undefined function error...any help here?
|
You have to specify --with-gd for the GD to be enabled. If you want PNG you also have to add --with-png-dir=/usr assuming your png libraries are in /usr.
|
ok now where do i specify that? in the php.ini file? and i have to go to other websites to get the jpg/png libraries right?
|
Search for extensions_dir, change it to where you installed php\extensions, and then uncomment the line for GD. In Windows you don't need to recompile it, just restart Apache.
edit: you can output PNGs and JPEGs directly with the built-in module. I think you can read GIFs, too. |
ok i did all that, except now when i restart apache it says it cannot load the dynamic library, module cannot be found, but it gives the path and the file IS there, php_gd.dll and php_gd2.dll are both there and i've tried doing both, im lost here
|
never mind, got it to work, i think i had the "extensions" directory name spelled wrong in php.ini, :)
|
Mr. E, you also might consider using a cron job to generate your image rather than just storing the stats in a text file or something. It will cut down on server load (to some extent).
|
lol, i have no idea how to work cron jobs
|
oh also, how come when i set it to create image from jpeg it's actually better quality (more colors) than png and when i do a jpeg and with the imagecolorallocate it never changes the text color, the bg is black and the text is there, but a very dark bluish color i think, i want to make it white
|
Use imagecolorclosest() for JPEGs rather than imagecolorallocate(). The functions are identical in syntax, but imagecolorclosest() is necessary when working with JPEGs.
|
oooh! cool thanks
|
All times are GMT. The time now is 06:53 PM. |
Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2025, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
![]() |
|
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|