savetheinternet / Tinyboard

The better imageboard software

Home Page:http://tinyboard.org

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Image posting not working

73james93 opened this issue · comments

Everytime I try to post a image on my board it says "Fatal error: Cannot redeclare imagecreatefrombmp() in xampp/vichan/inc/image.php on line 584"

I also get "count(): Parameter must be an array or an object that implements Countable" in the dashboard and the configuration page is all empty.

imagecreatefrombmp() is a function that's built-in to PHP. I guess the author was trying to polyfill this function for environments where the GD extension is unavailable.

Wherever you get an error complaining about redeclaring a function, try wrapping it in an if block:

if (! function_exists('imagecreatefrombmp') {
    function imagecreatefrombmp($image) { /* ... */ }
}

There may be more instances of this throughout the code (I noticed at least one a few lines down, imagebmp()).