jeudi 18 février 2021

Remove background image using remove.bg

I'm trying to use remove.bg to remove background image using this code.

Link : https://www.remove.bg/api

  $client = new \GuzzleHttp\Client();
    $res = $client->post('https://api.remove.bg/v1.0/removebg', [
        'multipart' => [
            [
                'name'     => 'image_file',
                'contents' => fopen('http://localhost:8000/download.jpg', 'r')
            ],
            [
                'name'     => 'size',
                'contents' => 'auto'
            ]
        
        ],
        'headers' => [
            'X-Api-Key' => 'XXXXXXXX'
        ]
    ]);
    $fp = fopen("result.jpg", "wb");
    fwrite($fp, $res->getBody());
    fclose($fp); 

getting this error :

fopen(http://localhost:8000/download.jpg): failed to open stream: HTTP request failed!



from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/3pvrr4z
via IFTTT

Aucun commentaire:

Enregistrer un commentaire