Link to home
Start Free TrialLog in
Avatar of Wojciech Duda
Wojciech Duda

asked on

imagecreatefromstring undefinded?

Hi,

can someone tell me why this piece of code:


    /**
    * Loads an image from a string (e.g. database)
    * @param string the image
    * @param mime mime type of the image
    * @return boolean
    * @access public
    */
    function loadData ($image,$mime) {
        if ( in_array($mime,$this->types) ) {
            $this->source=imagecreatefromstring($image);
            $this->sourceWidth=imagesx($this->source);
            $this->sourceHeight=imagesy($this->source);
            $this->sourceMime=$mime;
            $this->initThumb();
            return true;
        } else {
            trigger_error('Image MIME type '.$mime.' not supported');
            return false;
        }
    }

produces an error telling me imagecreatefromstring is not defined? Urgent.
Avatar of thecode101
thecode101

What version of php are you using?
Hi mcwojtekk,

The piece of code you have there is a part of a class, which I don't know if you have. On the row:
$this->source=imagecreatefromstring($image);

You are namely calling an function called: "imagecreatefromstring" with a parameter $image. This function must be defined somewhere and it isn't in the piece of code you have provided. If you have the function in the class try to put $this-> infront of so that you get:

$this->source=$this->imagecreatefromstring($image);

Good luck!
//madwax

Cheers!
Avatar of Wojciech Duda

ASKER

I have installed EasyPHP 1.7. I have the full class but it was coded by someone else. Now if I try to view the page this error comes up:

Fatal error: Call to undefined function: imagecreatefromstring() in c:\program files\easyphp1-7\www\*******_intranet\includes\lib\thumbnail.php on line 174

From what I understand this function is part of php, why the 'undefined' error?
ASKER CERTIFIED SOLUTION
Avatar of snoyes_jw
snoyes_jw
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Editing the php.ini helped. Thanks a lot.