Get a Free Trial
GrabzIt's Online Community

Dinamic image on header template

Ask questions on how to capture or convert web pages or HTML into images, MP4. CSV, PDF or DOCX documents as well on how to convert videos into animated GIF's using our API.

There are no forum posts on this topic! Why don't you write one?

Good morning,

I need to insert a dynamically loaded image. I tried to include an image in the header template using {img}.

Through PHP, I insert the img variable using $options->AddTemplateParameter("img",$url_image);

 

The image URL is correct, but the image is not visible in the DOCX; there is only an empty image object. How can I resolve this?

Thank you.

Asked by Salvatore Giuliano on the 5th of December 2023

Hi,

We don't recommend loading images dynamically in the template, we usually automatically convert them to data Uris. But I would check the loading time of the image it will need to be fast.

Perhaps try specifying a delay?

Also does it work for PDF?

Kind regards 

Answered by GrabzIt Support on the 5th of December 2023

what do you mean with "Perhaps try specifying a delay?" ?

 

thank you

Answered by Salvatore Giuliano on the 6th of December 2023

I mean set the delay parameter: https://grabz.it/api/php/technical-documentation/#filetodocx

Answered by GrabzIt Support on the 6th of December 2023

i add $options->setDelay(30000); but the image still not working

Answered by Salvatore Giuliano on the 6th of December 2023

i try with pdf but i have same problem

Answered by Salvatore Giuliano on the 6th of December 2023

Whats the image url?

Answered by GrabzIt Support on the 6th of December 2023

That seemed to work for me. Did you also specify the other image parameters you put in the image object such as imw and imh? I set these to 100, otherwise it would be a invalid image.

Answered by GrabzIt Support on the 6th of December 2023

i try with

$options->AddTemplateParameter("img",$image_data[0]);
$options->AddTemplateParameter("imw",100);
$options->AddTemplateParameter("imh",100);

 

but still not working

can you send me your code?

thank you

Answered by Salvatore Giuliano on the 6th of December 2023

It was only working locally for us, we have identified and fixed the problem. Please can you try again?

Answered by GrabzIt Support on the 6th of December 2023

now it works, thank you!

Answered by Salvatore Giuliano on the 6th of December 2023

No problem 

Answered by GrabzIt Support on the 6th of December 2023