目标是让 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"
我想我错过了什么