douan6931 2019-05-15 01:07
浏览 96

PHP将文件路径中的图像插入到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

  • 写回答

0条回答 默认 最新

    报告相同问题?

    悬赏问题

    • ¥15 素材场景中光线烘焙后灯光失效
    • ¥15 请教一下各位,为什么我这个没有实现模拟点击
    • ¥15 执行 virtuoso 命令后,界面没有,cadence 启动不起来
    • ¥50 comfyui下连接animatediff节点生成视频质量非常差的原因
    • ¥20 有关区间dp的问题求解
    • ¥15 多电路系统共用电源的串扰问题
    • ¥15 slam rangenet++配置
    • ¥15 有没有研究水声通信方面的帮我改俩matlab代码
    • ¥15 ubuntu子系统密码忘记
    • ¥15 保护模式-系统加载-段寄存器