Forum


Replies: 1   Views: 4040
Timeout when replacing variables with images
Topic closed:
Please note this is an old forum thread. Information in this post may be out-to-date and/or erroneous.
Every phpdocx version includes new features and improvements. Previously unsupported features may have been added to newer releases, or past issues may have been corrected.
We encourage you to download the current phpdocx version and check the Documentation available.

Posted by fpa.777  · 29-08-2014 - 13:27

Hi, I need to create a document from HTML, which has about 200 images. Since these image sources are URL's (for example, http://www.example.com/image/1.png), I wasn't able to use the addImage() method. I guess it only works with local files, correct? Also, directly using embedHTML() doesn't insert the images in the document, but only creates a link for them. Therefore, when offline the images aren't loaded. Ok, so what I do is to replace all the images with variables, save the document, and then open it again as a template, in order to use the replaceVariableByHTML() method. I did that because using this instead of embedHTML() actually inserts the image, instead of creating a link. Here's the problem: when I did the test with a couple of images, it went ok, but when I tried with 200, it keeps processing until timeout (30s I think). Is there something wrong with my approach? If so, is there any way to increase the timeout? Thank you very much! P.S.: Wasn't in scope but... the replaceVariablebyHTML() method always replaces entire block, regardless of the parameter that was passed on.