advanced custom fields – Parsing value from Lottie JSON file


I am creating a scrollable Lottie component in WordPress using Advanced Custom Fields. The component consists of a sticky positioned div housing the actual Lottie player and a wrapper that interpolates the playhead position of the Lottie player from 0 (top of the wrapper hits top of viewport) to 1 (bottom of wrapper hits bottom of viewport).

For the implementation I envision, the wrapper would be sized based on the duration of the Lottie animation, along the lines of style="height: calc(<?=$frame_count?> * 10vh)". The Lottie JSON file actually contains the duration of the animation but I can’t seem to access its contents. Here is what I tried so far:

$lottie_id = $row['lottie'];
$lottie_url = wp_get_attachment_url($lottie_id);
$lottie_json = json_decode(file_get_contents($lottie_url));

However, if I try to log the value of $lottie_json I get the following error messages:

file_get_contents(): SSL operation failed with code 1. OpenSSL Error messages: error:14090086:SSL routines:ssl3_get_server_certificate:certificate verify failed

file_get_contents(): Failed to enable crypto

file_get_contents(https://testing:8890/wp-content/uploads/2023/03/lottie.json): Failed to open stream: operation failed

Could anyone point me towards a solution? Thanks very much in advance.

wandervogel 1 month 2023-04-28T05:59:10-05:00 0 Answers 0 views 0

Leave an answer