0

I am using Symfony 3 and when I try to use imagecreatefromjpeg function in PHP it gives the following error.

Attempted to call function "imagecreatefromjpeg" from namespace "AppBundle\Controller"

How can I fix this?

Teshan N.
  • 2,307
  • 3
  • 30
  • 59
  • 1
    Do you have `gd` extension installed? Looks like this function doesn't exist in global scope, which is why php attempts to load it from current namespace. – Bartosz Zasada Oct 08 '19 at 11:27

2 Answers2

3

Do you already have enable/installed gd extension? If not, you have to install it. You can add it in composer.json( "ext-gd": "*" )

Muamar Ali
  • 155
  • 1
  • 9
1

Try using \imagecreatefromjpeg (from global namespace)

Manzolo
  • 1,909
  • 12
  • 13