@@ -15,12 +15,6 @@ final class Optml_Api {
15
15
* @var string Api root.
16
16
*/
17
17
private $ api_root = 'https://dashboard.optimole.com/api/ ' ;
18
- /**
19
- * Optimole upload api root url.
20
- *
21
- * @var string Api root.
22
- */
23
- private $ upload_api_root = 'https://generateurls-prod.i.optimole.com/upload ' ;
24
18
/**
25
19
* Optimole onboard api root url.
26
20
*
@@ -48,9 +42,6 @@ public function __construct() {
48
42
if ( defined ( 'OPTIML_API_ROOT ' ) ) {
49
43
$ this ->api_root = constant ( 'OPTIML_API_ROOT ' );
50
44
}
51
- if ( defined ( 'OPTIML_UPLOAD_API_ROOT ' ) ) {
52
- $ this ->upload_api_root = constant ( 'OPTIML_UPLOAD_API_ROOT ' );
53
- }
54
45
if ( defined ( 'OPTIML_ONBOARD_API_ROOT ' ) ) {
55
46
$ this ->onboard_api_root = constant ( 'OPTIML_ONBOARD_API_ROOT ' );
56
47
}
@@ -246,19 +237,6 @@ private function build_args( $method, $url, $headers, $params ) {
246
237
return $ args ;
247
238
}
248
239
249
- /**
250
- * Upload image to our servers using the generated signed url.
251
- *
252
- * @param string $upload_url The signed to url to upload the image to.
253
- * @param string $content_type Image mime type, it must match the actual mime type of the image.
254
- * @param string $image Image data from file_get_contents.
255
- * @return mixed
256
- */
257
- public function upload_image ( $ upload_url , $ content_type , $ image ) {
258
- $ args = $ this ->build_args ( 'PUT ' , '' , ['content-type ' => $ content_type ], $ image );
259
- return wp_remote_request ( $ upload_url , $ args );
260
- }
261
-
262
240
/**
263
241
* Check if the optimized url is available.
264
242
*
@@ -275,47 +253,6 @@ public function check_optimized_url( $url ) {
275
253
return true ;
276
254
}
277
255
278
- /**
279
- * Get options for the signed urls api call.
280
- *
281
- * @param string $original_url Image original url.
282
- * @param string $delete Whether to delete a bucket object or not(ie. generate signed upload url).
283
- * @param string $table_id Remote id used on our servers.
284
- * @param string $update_table False or success.
285
- * @param string $get_url Whether to return a get url or not.
286
- * @param string $width Original image width.
287
- * @param string $height Original image height.
288
- * @param int $file_size Original file size.
289
- * @return array|WP_Error
290
- */
291
- public function call_upload_api ( $ original_url = '' , $ delete = 'false ' , $ table_id = '' , $ update_table = 'false ' , $ get_url = 'false ' , $ width = 'auto ' , $ height = 'auto ' , $ file_size = 0 ) {
292
- $ body = [
293
- 'secret ' => Optml_Config::$ secret ,
294
- 'userKey ' => Optml_Config::$ key ,
295
- 'originalUrl ' => $ original_url ,
296
- 'deleteUrl ' => $ delete ,
297
- 'id ' => $ table_id ,
298
- 'updateDynamo ' => $ update_table ,
299
- 'getUrl ' => $ get_url ,
300
- 'width ' => $ width ,
301
- 'height ' => $ height ,
302
- 'originalFileSize ' => $ file_size ,
303
- ];
304
- $ body = wp_json_encode ( $ body );
305
-
306
- $ options = [
307
- 'body ' => $ body ,
308
- 'headers ' => [
309
- 'Content-Type ' => 'application/json ' ,
310
- ],
311
- 'timeout ' => 60 ,
312
- 'blocking ' => true ,
313
- 'sslverify ' => false ,
314
- 'data_format ' => 'body ' ,
315
- ];
316
- return wp_remote_post ( $ this ->upload_api_root , $ options );
317
- }
318
-
319
256
/**
320
257
* Send a list of images to upload.
321
258
*
0 commit comments