目标是让php编辑rtf文件,以通过构建一些rtf代码来从服务器插入图像,然后根据其他问题插入该图像:
{\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."}";
然后我使用file_put_contents()
将cd_image字符串添加到rtf文件中。
但是打开rtf文件时唯一显示的是
"ffd8ffe000104a46494600010101012c012c0000ffe11b044578696600004d4d002a00000008000d010e000200000095000000aa010f00020000000600000140011000020000001500000146011200030000000100010000011a0005000000010000015c011b0005000000010000016401280003000000010002000001310002000000200000016c01320002000000140000018c013b00020000000d000001a0021300030000000100010000829800020000001b000001ae876900040"
我认为我缺少一些东西