[Help] Two errors in general.init.php showing up on every page?

edited June 2012 in Troubleshooting
Hey guys,

I just installed this on my web host tonight, which I am sure supports php, and according to pho.info also supports GD.

This is the error I am getting on every page, and seem to be having issues with some thumbnails and pictures displaying properly, others work just fine.

Deprecated: Function ereg_replace() is deprecated in /home/taylorne/public_html/albums/libraries/general.init.php on line 96

Notice: Undefined index: JPG Support in /home/taylorne/public_html/albums/libraries/general.init.php on line 100

Anyone have any ideas how to fix this? Would be greatly appreciated!

If I can get this running smooth, will be more than happy to donate.

Thank you.

Comments

  • Looks like ereg_replace is deprecated from PHP 5.3 onwards which may be causing this issue.
  • mmm that solution link doesn't work...
  • you can replace ereg_replace with preg_replace.
    Aferwards general.init.php line 96 should look like this:
    " $gd['num'] = preg_replace('/[[:alpha:][:space:]()]+/','',$gda['GD Version']);"
  • I'll add that change to the next release, thanks all.
  • Go to /libraries/general.init.php. Then do this as followings:

    Change:"$gd['num'] = ereg_replace('[[:alpha:][:space:]()]+','',$gda['GD Version']);"

    To:preg_match('/\d/', $gda['GD Version'], $match);

    $gd['num'] = $match[0];

    Should solve your problem.

    Beckmann

  • for your second error:

    "Notice: Undefined index: JPG Support in /home/taylorne/public_html/albums/libraries/general.init.php on line 100"

    go to line 100 or find this:

    $gd['jpg'] = $gda["JPG Support"];

    change it to this:

    $gd['jpg'] = $gda["JPEG Support"];

    If you are using PHP 5.3, they renamed the index from "JPG Support" to "JPEG Support"
  • edited March 2013
    @chrisg you should use an wider approach:

    change the libraries/general.init.php to:
    if (PHP_VERSION_ID >= 50300) {
    $gd['jpg'] = $gda["JPEG Support"];
    } else {
    $gd['jpg'] = $gda["JPG Support"];
    }


    and add this to libraries/general.bootstrap.php after the first "header comment"
    if (!defined('PHP_VERSION_ID')) {
    $version = explode('.', PHP_VERSION);
    define('PHP_VERSION_ID', ($version[0]* 10000 + $version[1]*100 + $version[2]));
    }
  • edited April 2013
    easier would be to just change:
    $gd['jpg'] = $gda["JPEG Support"];

    to:
    $gd['jpg'] = ($gda["JPEG Support"]) ? $gda["JPEG Support"] : $gda["JPG Support"];

    it should work.
Sign In or Register to comment.