write image to a woed document

Discussion in 'PHP' started by z0ro, Jul 20, 2008.

  1. #1
    hi,
    i want to know how can i write an image to a word document that i am writing a string to it too.
    $str="hello world"
    $fp = fopen("test.doc", "w+");
    fwrite($fp,$str);
    fclose($fp);
    PHP:
    is there a way to add an image to $str so i can write the image with the string to the doc file?

    thank you
     
    z0ro, Jul 20, 2008 IP
  2. nico_swd

    nico_swd Prominent Member

    Messages:
    4,153
    Likes Received:
    344
    Best Answers:
    18
    Trophy Points:
    375
    #2
    .doc documents are binary, and you can't manipulate them that easily.

    There's however a HTML-a-like .doc version. Save it as such and then you'll be able to add images using HTML (<img src="xxx" />). There's a class on www.phpclasses.org ... take a look there.
     
    nico_swd, Jul 21, 2008 IP