You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
1.1.0 adds support for adding custom request body parameters. The remove.bg api has developed beyond its first initial release where it only allowed a limited set of request body parameters.
Now you can specify paramters such as, "type", "format", "roi", "crop", "bg_color" and many more.
This package now supports all of these request body parameters with the 'body' method.
Happy background removing!
Remove.bg offers several parameters for each api call. For an up to date list, you should always check the [remove.bg api documentation](https://www.remove.bg/api).
89
+
Remove.bg offers several request body parameters for each api call. For an up to date list, you should always check the [remove.bg api documentation](https://www.remove.bg/api).
90
90
91
-
Here is an example of an api call configured with specific parameters.
91
+
Here is an example of an api call configured with specific request body parameters.
92
92
93
93
````php
94
94
$removebg = new RemoveBg($apiKey);
95
95
96
96
// Directly saving files
97
97
$removebg->url($absoluteUrl)
98
-
->headers([
98
+
->body([
99
99
'size' => '4k', // regular, medium, hd, 4k, auto
100
-
'type' => 'product', // auto, person, product
100
+
'bg_color' => '#CBD5E0',
101
+
'add_shadow' => true, // primarily used for automotive photos as of the time this documentation was written
101
102
'channels' => 'rgba', // rgba, alpha
102
103
])
103
104
->save('path/to/your/file.png');
104
105
````
106
+
107
+
You may also directly specify request header parameters. As of right now this does not appear to offer much functionality in terms of how the Remove.bg api will consume these headers, but we thought it was important to expose this functionality. Consider the following example:
108
+
109
+
````php
110
+
$removebg = new RemoveBg($apiKey);
111
+
112
+
// Directly saving files
113
+
$removebg->url($absoluteUrl)
114
+
->headers([
115
+
'X-Foo-Header' => 'Some Bar Value',
116
+
'X-Foo-Header-2' => 'Some Bar Value 2',
117
+
])
118
+
->save('path/to/your/file.png');
119
+
````
120
+
105
121
### Using the global helper (Laravel)
106
122
107
123
If you are using Laravel, this package provides a convenient helper function which is globally accessible.
0 commit comments