tags:

views:

777

answers:

1

How can I insert an image to an RTF file. Inside the RTF file there is a placeholder text like {photo}. I want to place the image at this position using php.

+1  A: 

I found an open source PHP library that allows insertion of images to PHP-generated RTF documents. It's called PHPRTF.

Here's the sample code that inserts images: link

RaYell
Yes, i was able to inser the image to an RTF file. I used the RTF standard specification, and placed the hex code of the image preceded by some header values specified in the RTF document.
coderex
When opening in a MS Word, it shows the image, but in Wordpad the image is missing. And I found that when placing the image manually in an RTF file generates some more code. like the same what i generated with the code + some more like"{\nonshppict" and the same header values + a very large hexa code. Inside that code there was the hex code for the image. But it is in between some other hex values.I dont know how this other hex is generated...that is on what basis....
coderex