PDA

View Full Version : Checking an include?


colicab-d
06-25-2003, 02:58 PM
Ok just a quick wee question :D

How would I go about checking if GD was enabled using php,

Im writing a script that uses it at the moment and need to be able to have it print out the version of GD being used.

I als want to define extra conditions depending on the version enabled on the server.


i.e


if($gdversion=="1.0"){
$enable = false;
}

Xenon
06-25-2003, 03:13 PM
there is a nice function gd_info :)

http://de2.php.net/manual/de/function.gd-info.php

filburt1
06-25-2003, 03:44 PM
You can also tell if it exists at all via something like:

if (function_exists("imagecreate")) // or function_defined

Xenon
06-25-2003, 08:18 PM
but that won't give him the version filbie ;)

assassingod
06-25-2003, 08:25 PM
<?php
phpinfo();
?>


Would work as well, tells you GD info there

colicab-d
06-25-2003, 09:01 PM
lol yeah mate.. i need to get it as a variable in the code mate..

Lol I do know you can get via php info :D

S.Shady
06-25-2003, 09:37 PM
im trtying to figure out how to install it on my localhost. anyone done it yet and can lead me in doing this ?

MUG
06-25-2003, 09:39 PM
Today at 12:13 PM Xenon said this in Post #2 (https://vborg.vbsupport.ru/showthread.php?postid=412614#post412614)
there is a nice function gd_info :)

http://de2.php.net/manual/de/function.gd-info.php That only works on 4.3.0 and above, where you can usually assume that the GD version is 2.0 :p

Brad
06-26-2003, 12:56 AM
Mabey a admin controled switch like in vB 3? ;).

N!ck
06-26-2003, 01:05 AM
Easiest solution to see if you have 2.0, IMO, follows.


if (function_exists("imagealphablending"))
{
$enable=1;
}


Combined two ideas of filburt's. :)

Xenon
06-26-2003, 05:04 AM
i think gd_info belongs to the gd lib, not to php 4.3 itself

so this might work:
if(function_exists('gd_info'))
{
... use function to get version
}


@S.Shady: you have to make sure you have gd.dll on your php directory and then enable the module within php.ini