Jump to content

Need help !!! Read and write image file in php


prema

Recommended Posts

Hi,

 

I want to read image file and write in to word document file using php. Actually i am developing shopping cart site. for that i have created barcode image. i need to take print outs. for example if i click print means same barcode should be generate 64 times in word document. how i do it?

 

i have tried with COM. please check the following code

 

 

<?php

// starting word

 

$word = new COM("word.application") or die("Unable to instantiate Word");

echo "Loaded Word, version {$word->Version}\n";

 

//bring it to front

$word->Visible = 1;

 

//open an empty document

$word->Documents->Add();

 

//do some weird stuff

 

 

for($i=1;$i<=64;$i++)

{

 

$word->Selection->InlineShapes->AddPicture("D:\Program Files\wamp\www\b.jpg ",false, True);

 

}

 

 

$word->Documents[1]->SaveAs("D:\Program Files\wamp\www\Uselesstest.doc");

 

//closing word

$word->Quit();

 

//free the object

$word = null;

?>

 

 

It works fine in local. but it is not working in server  (it says COM.class is missing). i have checked some forums they said it works with MS based operation system.  i have checked with windows only.

 

 

Please kindly any one help me asap the way for read and write image file in word document.

 

can we do this any other way?

 

we are reading and writing txt files using php

the same can we do with image file (read and write in word document) ??

 

Thanks

Prema

Link to comment
Share on other sites

yes i want to insert the picture in word document.  i have attached one document. please check it. same like i want  using php. don't want PHP com code for this.  because it won't be work with linux platform. it works only MS based operating system.

 

 

I have tried with Curl , also file_get_contents concept. its read whole webpage. i want to read that particular barcode image and should insert in word document.

 

[attachment deleted by admin]

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.