We have moved our forum to GitHub Discussions. For questions about Phalcon v3/v4/v5 you can visit here and for Phalcon v6 here.

GD not working


I'm using a built on INVO version and my GD has stopped working. I get Internal Error whenever I try to load a image through GD. I have one function to load the image. Then I send that image to another function, this is where it fails.

First I load GD:

use Phalcon\Image\Adapter\GD as GD;

In my function I pass a image, then load it in the function.

    private function NewCover($data, $images, $thumbnail_1, $thumbnail_2) {
        foreach ($images as $file) {
            $temp_name = $file->getTempName();
            $image = new GD($temp_name); //ERROR HERE
            var_dump("I'm not loaded :( ");exit;

The first var-drump returns

string(14) "/tmp/phpGJGG46"

So I know that a image is loaded...

Then I get the errror when I try to load GD

I have no idea why I keep getting this error. It used to work before, not sure what has changed. ANy help is greatly appriciated!! Ps: I tried with Imageick to, same Internal Error.

IF it helps, here is the function that calls this one:

    public function NewHangoutCoverAction($hangout_id) {
        if ($this->request->isPost()) {
            $data = $this->request->getPost();
            if ($this->Validate($data['w'], $data['h'], $data['x1'], $data['y1'])) {
                $hangout = Hangout::findFirstById($hangout_id);
                if ($hangout) {
                    if ($hangout->user->id == $this->user->id) {
                        if ($this->request->hasFiles() == true) {
                            $images = $this->request->getUploadedFiles();
                            $thumbnail_1 = 'images/hangout_images/' . $hangout->id . '/cover/';
                            if (file_exists($thumbnail_1) == false) {
                                mkdir($thumbnail_1, 0777, true);
                            $thumbnail_2 = $hangout->name . '_' . time() . '.jpg';

                            $this->NewCover($data, $images, $thumbnail_1, $thumbnail_2);

                            $this->NewHangoutCoverImage($data['main'], $data['title'], $hangout, $thumbnail_2);
            } else {
                // Validation failed
                $this->flash->error("Validation failed. Did you enter a crop region?");
        return $this->_redirectBack();

Thank you!!



Do you have install the library at https://php.net/manual/en/image.installation.php?



I had a kind of same problem here: https://github.com/phalcon/cphalcon/issues/1663

But first have a look at your webserver error log file. It should tell you what cause the error 500