Laravel-Vue 带有重定向 url 的 Http 请求

问题描述 投票:0回答:0

实现方式是将图像解码为Base64,图像链接来自google存储,使用浏览器时该链接会获取从google登录的用户信息,并检查该用户是否被允许访问该图像谷歌存储。 但问题是

Http::get
仍在重定向过程中获取用户详细信息,然后对其进行解码,这是错误的,应该完成所有过程。 如何解决这个问题?

  try{
            
            $imageUrl = 'https://urlOfGoogleStorageLink';
        
        $response = Http::get($imageUrl);
     
    
            $imageData = $response->body();
    
            // Convert image data to base64
            $base64Image = base64_encode($imageData);

            // Create a data URI for the image
            $dataUri = 'data:image/png;base64,' . $base64Image;

            return response()->json($dataUri,200);

        }catch(Exception $error){
            dd( $error);
        }

从 google stoge 图片中解码图片链接

php laravel vue.js decode
© www.soinside.com 2019 - 2024. All rights reserved.