Plugins – WARNING: File_Get_Contents in php 8.1 wordpress

I recently changed the PHP version from 7.4 to 8.1 but after the change, I get an error while posting content in wordpress You need to know that despite this error, the article will be sent, but this error bothered me I have activated wordpress debugger, the error was referring to active plugin in wordpress this line:

$pictureFile = file_get_contents($imageFilePath);

More complete code of this plugin:

 $mp3FilePath = get_attached_file($_POST["mp3_file_id"]);
    $thumb_id = get_post_thumbnail_id($postId);
    $imageFilePath = get_attached_file($thumb_id);

    $pictureFile = file_get_contents($imageFilePath);

    $info = array(
        "artist"=>$_POST["mp3_artist"],
        "album"=>$_POST["mp3_album"],
        "comment"=>$_POST["mp3_comment"],
        "title"=>$_POST["mp3_caption"],
        "cover_data" => array(
            array (
                'data'=> $pictureFile,
                'picturetypeid'=> 3,
                'mime'=> 'image/jpeg',
                'description' => 'My Picture'
            )
        )

Leave a Comment