Php detectar versión GD


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. function getVersionGD() {
  2. $gd = array();
  3. $GDfuncList = get_extension_funcs('gd');
  4. @phpinfo(INFO_MODULES);
  5. $output=ob_get_contents();
  6. $matches[1]='';
  7. if (preg_match("/GD Version[ \t]*(<[^>]+>[ \t]*)+([^<>]+)/s",$output,$matches)) {
  8. $gdversion = $matches[2];
  9. }
  10. if ($GDfuncList) {
  11. if (in_array('imagegd2', $GDfuncList)) {
  12. $gd['gd2'] = $gdversion;
  13. } else {
  14. $gd['gd1'] = $gdversion;
  15. }
  16. }
  17. return $gd;
  18. }

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.