1

I have a image model, but after I have started using intervention image to resize images, I have a problem with class conflict because they both have the class name Image.

I have tried to change the alias in app.php, so that intervention facade name is imageIntervention instead of image:

'ImageIntervention'     => 'Intervention\Image\Facades\Image'

But how do I use this facade in my imageController?

Thanks - Andreas

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291
Andreas Baran
  • 669
  • 1
  • 12
  • 27

2 Answers2

2

Just use it like you would use Image... e.g. ImageIntervention::make(...)

Don't forget to import the alias:

use ImageIntervention;

Or prepend each call by a backslash:

\ImageIntervention::make(...)

Otherwise PHP will try to find an ImageIntervention class inside your current namespace.


By the way, you probably don't have to rename Image to ImageIntervention because your model is namespaced (at least per default, App\Image). However I would still leave it that way to avoid confusion.

lukasgeiter
  • 147,337
  • 26
  • 332
  • 270
1

You need to import ImageIntervention in your controller.

Just add:

use ImageIntervention;

before class definition of your controller.

Marcin Nabiałek
  • 109,655
  • 42
  • 258
  • 291