@@ -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
}
@@ -258,19 +249,6 @@ private function build_args( $method, $url, $headers, $params ) {
258
249
return $ args ;
259
250
}
260
251
261
- /**
262
- * Upload image to our servers using the generated signed url.
263
- *
264
- * @param string $upload_url The signed to url to upload the image to.
265
- * @param string $content_type Image mime type, it must match the actual mime type of the image.
266
- * @param string $image Image data from file_get_contents.
267
- * @return mixed
268
- */
269
- public function upload_image ( $ upload_url , $ content_type , $ image ) {
270
- $ args = $ this ->build_args ( 'PUT ' , '' , ['content-type ' => $ content_type ], $ image );
271
- return wp_remote_request ( $ upload_url , $ args );
272
- }
273
-
274
252
/**
275
253
* Check if the optimized url is available.
276
254
*
@@ -287,47 +265,6 @@ public function check_optimized_url( $url ) {
287
265
return true ;
288
266
}
289
267
290
- /**
291
- * Get options for the signed urls api call.
292
- *
293
- * @param string $original_url Image original url.
294
- * @param string $delete Whether to delete a bucket object or not(ie. generate signed upload url).
295
- * @param string $table_id Remote id used on our servers.
296
- * @param string $update_table False or success.
297
- * @param string $get_url Whether to return a get url or not.
298
- * @param string $width Original image width.
299
- * @param string $height Original image height.
300
- * @param int $file_size Original file size.
301
- * @return array|WP_Error
302
- */
303
- public function call_upload_api ( $ original_url = '' , $ delete = 'false ' , $ table_id = '' , $ update_table = 'false ' , $ get_url = 'false ' , $ width = 'auto ' , $ height = 'auto ' , $ file_size = 0 ) {
304
- $ body = [
305
- 'secret ' => Optml_Config::$ secret ,
306
- 'userKey ' => Optml_Config::$ key ,
307
- 'originalUrl ' => $ original_url ,
308
- 'deleteUrl ' => $ delete ,
309
- 'id ' => $ table_id ,
310
- 'updateDynamo ' => $ update_table ,
311
- 'getUrl ' => $ get_url ,
312
- 'width ' => $ width ,
313
- 'height ' => $ height ,
314
- 'originalFileSize ' => $ file_size ,
315
- ];
316
- $ body = wp_json_encode ( $ body );
317
-
318
- $ options = [
319
- 'body ' => $ body ,
320
- 'headers ' => [
321
- 'Content-Type ' => 'application/json ' ,
322
- ],
323
- 'timeout ' => 60 ,
324
- 'blocking ' => true ,
325
- 'sslverify ' => false ,
326
- 'data_format ' => 'body ' ,
327
- ];
328
- return wp_remote_post ( $ this ->upload_api_root , $ options );
329
- }
330
-
331
268
/**
332
269
* Send a list of images to upload.
333
270
*
0 commit comments