Call to undefined function App\Controller\imagejpeg()

I’m trying to create something to watermark the images I use on my blog.
For this, I have updated an older script that I used to use (just some small clean-ups, nothing major).
With “plain” PHP (without CakePHP), this script works like it should, however, in CakePHP I get Call to undefined function App\Controller\imagejpeg().
imagejpeg() is part of php-gd which I have installed.

Any way of fixing this?