PHP Inserting an image from file path into an rtf doc

The goal is to have php edit an rtf file to insert an image from the server by building some rtf code which according to other questions should insert the image:

{\pict\wmetafile8\picw[N]\pich[N]\picwgoal[N]\pichgoal[N] [BYTES]}

        $picture_tag = "picture"; //\pict
        $image_type = "8"; //\wmetafile[N]
        $image_width = "100"; //\picw[N]
        $image_height = "100"; //\pich[N]
        $target_width = "100"; // \picwgoal[N]
        $target_height = "100"; // \pichgoal[N]
        $image_hex = bin2hex(file_get_contents("assets/image.jpeg")); // [BYTES]

        //insert the variables into the rtf code:
        $cd_image = \pict".$picture_tag."\wmetafile".$image_type."\picw".$image_width."\pich".$ima 
        ge_height."\picwgoal".$target_width."\pichgoal".$target_height." 
        ".$image_hex."}";

Then i use file_put_contents() to add that cd_image string into the rtf file.

But the only thing that shows up when i open the rtf file is

"ffd8ffe000104a46494600010101012c012c0000ffe11b044578696600004d4d002a00000008000d010e000200000095000000aa010f00020000000600000140011000020000001500000146011200030000000100010000011a0005000000010000015c011b0005000000010000016401280003000000010002000001310002000000200000016c01320002000000140000018c013b00020000000d000001a0021300030000000100010000829800020000001b000001ae876900040"

i think im missing something