标签: intervention

必须安装/启用PHP Fileinfo扩展才能使用Intervention Image

我在Laravel 5项目中使用了干预图像包.它在本地服务器上工作.现在,当我通过cpanel上传到共享服务器时,我收到错误:

MissingDependencyException in ImageManager.php line 123:
PHP Fileinfo extension must be installed/enabled to use Intervention Image.
Run Code Online (Sandbox Code Playgroud)

服务器具有PHP版本5.6.19

我经历了需要ext-fileinfo.如何将其添加到我的composer.json文件中?但无法得到解决方案.php.ini我的cpanel里面的文件在哪里?

php laravel-5 intervention

3
推荐指数
1
解决办法
9942
查看次数

调用未定义的方法Intervention \ Image \ Facades \ Image :: make()

我通过干预/图像从Laravel4.2升级到Laravel5.3:“ ^ 2.3”,

 if (Input::hasFile('logo')) {

        $path = public_path()."/assets/admin/layout/img/";
        File::makeDirectory($path, $mode = 0777, true, true);

        $image      = Input::file('logo');
        $extension  = $image->getClientOriginalExtension();
        $filename   = "logo.$extension";
        $filename_big   = "logo-big.$extension";

        Image::make($image->getRealPath())->save($path.$filename);
        Image::make($image->getRealPath())->save($path.$filename_big);

        $data['logo']   =   $filename;

    }
Run Code Online (Sandbox Code Playgroud)

结果我出错

Call to undefined method Intervention\Image\Facades\Image::make()
Run Code Online (Sandbox Code Playgroud)

intervention laravel-5.3

2
推荐指数
1
解决办法
7053
查看次数

Laravel + Image Intervention:强制下载未保存的文件

我只想上传文件,调整大小,然后为每个上传的文件强制下载。我不希望保存的文件。

调整大小等工作正常,但是我无法设法强制下载新文件。

$content = $image->stream('jpg');

return response()->download($content, $name);
Run Code Online (Sandbox Code Playgroud)

所示出的片段的结果在

is_file()期望参数1为有效路径,给定字符串

很有可能是因为$ content不是路径而是实际数据。

有没有强制执行下载而不先保存下载的方法?

laravel laravel-5 intervention laravel-5.4

2
推荐指数
1
解决办法
1360
查看次数

How to add watermark image in laravel 5.2 in intervention package?

I am using laravel 5.2 framework and i am using intervention package of laravel that runs fine for me. Now here i face one problem i don't know what i amd doing wrong. Please help:-

$myimage = Image::make(storage_path('app/images/test1.jpg'));
//Suppose $imyimage width is 3024 and height is 2016
$actualwidth = 3024;
$actualheight = 2016;
Run Code Online (Sandbox Code Playgroud)

Now, when i tried these sizes 3024 * 2016 pixel then watermark is not visible while when i zoom the image then it is visible Now suppose …

php watermark laravel intervention laravel-5.2

2
推荐指数
1
解决办法
5595
查看次数

Laravel 8 未安装图像干预包

您的要求无法解析为一组可安装的软件包。

问题1

- intervention/image[2.5.0, ..., 2.5.1] require guzzlehttp/psr7 ~1.1 -> found guzzlehttp/psr7[1.1.0, ..., 1.x-dev] but the package is fixed to 2.0.0 (lock file version) by a partial update and that version does not match. Make sure you list it as an argument for the update command.
- Root composer.json requires intervention/image ^2.5 -> satisfiable by intervention/image[2.5.0, 2.5.1].
Run Code Online (Sandbox Code Playgroud)

使用选项 --with-all-dependencies (-W) 允许升级、降级和删除当前锁定到特定版本的软件包。

作曲家.json

{
"name": "laravel/laravel",
"type": "project",
"description": "The Laravel Framework.",
"keywords": ["framework", "laravel"],
"license": "MIT",
"require": {
    "php": "^7.3|^8.0", …
Run Code Online (Sandbox Code Playgroud)

image intervention

2
推荐指数
1
解决办法
3401
查看次数

Laravel 中的干预未上传大图像

在我的 Laravel 设置中,我目前使用 Intervention 进行图像上传。

但是,目前还没有上传超过 3MB 大小的图片。

ini_get('upload_max_filesize')并分别ini_get('post_max_size')给我 5MB 和 8MB。

我的图像保存控制器如下:

public function saveImage(Request $request) {
   if (Auth::check()) {
        $this->validate($request, [
            'title' => 'required|max:50|min:2|alpha_num',
            'mature' => 'required',
            'categorie' => 'required',
            'description' => 'string|max:2000',
            'fileUpload' => 'required',
        ]); 

        $galleryConfirmation = Gallery::where('id', $request->get('gallerySelect'))->value('created_by');

        if (Auth::user()->id == $galleryConfirmation || $galleryConfirmation == 0 || $galleryConfirmation == null ) {

            $file = $request->file('fileUpload');

            if ($file->getClientSize() > 3999999) {
                dd("nooooo");
            }

            $filename = time() . '.' . $file->getClientOriginalExtension() ;

            Image::make($file)->save( public_path('/uploads/artistUploads/' …
Run Code Online (Sandbox Code Playgroud)

php laravel intervention

1
推荐指数
1
解决办法
2951
查看次数

php laravel图像干预中的Stream()函数是什么

我想知道图像干预中的stream()函数做什么吗?http://image.intervention.io/api/stream

现在,我将像这样将图像上传到亚马逊S3:

public function uploadLargeAndMainImages($file,$adId)
  {
    $s3 = Storage::disk('s3');
    $extension = $file->guessExtension();
    $filename = uniqid() . '.' . $extension;

    //Create and resize images
    $image = Image::make($file)->resize(null, 600, function ($constraint) {
        $constraint->aspectRatio();
    });
    $image->encode($extension);

    $imageLarge = Image::make($file)->resize(null, 800, function ($constraint) {
        $constraint->aspectRatio();
    });
    $imageLarge->encode($extension);

    // upload image to S3
    $s3->put("images/{$adId}/main/" . $filename, (string) $image, 'public');
    $s3->put("images/{$adId}/large/" . $filename, (string) $imageLarge, 'public');

    // make image entry to DB
    $file = File::create([
        'a_f_id' => $adId,
        'file_name' => $filename,
    ]);

  }
Run Code Online (Sandbox Code Playgroud)

php image laravel intervention

1
推荐指数
1
解决办法
1782
查看次数

在laravel 5.3 中使用邮递员在服务器上上传图像文件的问题?

我正在对文件大小调整功能和文件上传进行干预。在控制器中,我只是检查hasFile()与否。所以,即使我使用邮递员正确发送它,每次我收到“不”的回应也是如此。可能是什么问题?

我的路线

Route::post('contact/image/upload',[  
  'as'=> 'intervention.postresizeimage',
  'uses'=>'contactController@upload_image'
]);
Run Code Online (Sandbox Code Playgroud)

控制器中的代码

public function upload_image(Request $request){

      if((preg_match("/^[789]\d{9}$/", $request->header('UID')))){
        if($request->hasFile('photo'))
          return "yes";
        else
          return "no";


        $photo = $request->file('photo');
        $imagename = time().'.'.$photo->getClientOriginalExtension(); 

        $destinationPath_thumb = storage_path('images/thumbnail_images');
        $thumb_img = Image::make($photo->getRealPath())->resize(100, 100);
        $thumb_img->save($destinationPath_thumb.'/'.$imagename,80);

        $destinationPath_medium = storage_path('images/medium_images');
        $medium_img = Image::make($photo->getRealPath())->resize(500, 500);
        $medium_img->save($destinationPath_medium.'/'.$imagename,80);

        $destinationPath_original = storage_path('images/original_images');
        $photo->move($destinationPath_original, $imagename);

        $user = \App\User::select(['inst_id'])->where('mobile','=',$request->header('UID'))->first();

        $update_img = \App\Contact::where([['id','=',$request->ID],['inst_id','=',$user->inst_id]])->update(['image'=>$imagename]);

        if($update_img)
          $response = response()->json(['data'=>[], 'error'=>0,  'error_msg'=>'', 'message'=>'Profile updated']);
        else
          $response = response()->json(['data'=>[], 'error'=>1,  'error_msg'=>'some went wrong', 'message'=>'Please try again']);
      }
      else
         $response = response()->json(['data'=>[], 'error'=>1, …
Run Code Online (Sandbox Code Playgroud)

php laravel intervention laravel-5.3

1
推荐指数
1
解决办法
1724
查看次数

Intervention\Image\Exception\NotSupportedException 不支持编码格式 (tmp)

我在 Laravel 5.6 中使用干预包,每当我上传文件时都会遇到这个问题,我遇到了错误编码格式(tmp)不受支持。我也启用了我的 gdd2 扩展。这是我使用过的代码。

public function store(Request $request)
    {
        $this->validate($request , [
            'name'          => 'required|unique:categories',
            'description'   =>  'max:355',
            'image'         =>  'required|image|mimes:jpeg,bmp,png,jpg'
        ]);

        // Get Form Image
        $image = $request->file('image');
        $slug = str_slug($request->name);
        if (isset($image))
        {
            $currentDate = Carbon::now()->toDateString();
            $imageName = $slug.'-'.$currentDate.'-'.uniqid().'.'.$image->getClientOriginalExtension();
            // Check if Category Dir exists
            if (!Storage::disk('public')->exists('category'))
            {
                Storage::disk('public')->makeDirectory('category');
            }
            // Resize image for category and upload
            $categoryImage = Image::make($image)->resize(1600,479)->save();
            Storage::disk('public')->put('category/'.$imageName, $categoryImage);

            // Check if Category Slider Dir exists
            if (!Storage::disk('public')->exists('category/slider'))
            {
                Storage::disk('public')->makeDirectory('category/slider');
            }

            // Resize …
Run Code Online (Sandbox Code Playgroud)

laravel intervention

1
推荐指数
1
解决办法
1万
查看次数

如何在laravel中将jpeg/jpg编码为webp

我正在使用 laravel 7 并使用干预/图像来存储图像。但是,我想将图像编码和存储为 webp,我使用以下代码,但它不是在 webp 中编码图像,而是以原始格式存储。你能告诉我我做错了什么吗?

public function storePoster(Request $request, Tournament $tournament)
{
    if ($request->hasFile('poster')) {
        $tournament->update([
            'poster' => $request->poster->store('images', ['disk' => 'public_uploads']),
        ]);
        $image = Image::make(public_path('uploads/' . $tournament->poster))->encode('webp', 90)->resize(200, 250);
        $image->save();
    }
}
Run Code Online (Sandbox Code Playgroud)

php laravel intervention

1
推荐指数
1
解决办法
4795
查看次数