Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

I am trying to use Imagick with Symfony2, but every time I try and use it, it gives me the following error:

Fatal error: Class 'AcmeTestBundleServicesImagick' not found...

I am using Imagick in a service I have setup to manage my images. What do I need to do to be able to use this class?

I can confirm the Imagick extension is working on the server and is in use by other sites.

Thanks in advance for any help.

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
187 views
Welcome To Ask or Share your Answers For Others

1 Answer

When you instantiate the Imagick class, use a full quallified class-name:

new Imagick;

This will make PHP not look for the class Imagick within the current namespace.

For a more detailed explanation see a similar Question/Answer: Problems with PHP namespaces and built-in classes, how to fix? and How to use "root" namespace of php?.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...