admin管理员组文章数量:1356258
I am having a problem with intervention image and Laravel 11. I am upgrading a program which is fine with Laravel 10.
I installed with
composer require intervention/image-laravel
and then ran
php artisan vendor:publish --provider="Intervention\Image\Laravel\ServiceProvider"
I have also installed Unisharp's filemanager and I notice that the composer.json file has these two entries
"intervention/image": "^3.11",
"intervention/image-laravel": "^1.5",
I have a function to resize which includes
if (!file_exists($image2)) {
//200 wide
if (file_exists($image)) {
$destinationPath = $path2;
$imgsave2 = $destinationPath . '/' . $img;
$img2 = Image::read($image);
$img2
->resize(200, null, function ($constraint) {
$constraint->aspectRatio();
})
->save($imgsave2);
}
}
(This simply takes in the image as image2 and the destination path and places it in a subdirectory based on the image size, hence the destination path). This function has
use Intervention\Image\Laravel\Facades\Image;
at the top
When I first tried to use this I had am image that it could not find Image so I setup a facade as
class AliasServiceProvider extends ServiceProvider
{
/**
* Register services.
*/
public function register(): void
{
$loader = AliasLoader::getInstance();
$loader->alias('Image', Intervention\Image\Laravel\Facades\Image::class);
}
/**
* Bootstrap services.
*/
public function boot(): void
{
//
}
Also in the providers in the bootstrap directory I have:
App\Providers\AliasServiceProvider::class,
Now when I try to use it I am getting an error
Unable to resolve driver. Argument must be either an instance of Intervention\Image\Interfaces\DriverInterface::class or a qualified namespaced name of the driver class.
I am going around and around with this any help would be very greatly appreciated.
本文标签: Intervention Image and Laravel 11Stack Overflow
版权声明:本文标题:Intervention Image and Laravel 11 - Stack Overflow 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1744004446a2574444.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论