Forum


Replies: 1   Views: 3141
Cant create hyperlink from image
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 irishadar  · 13-07-2016 - 12:28

Hi iv'e created an image :             

 $imageBlb1 = new WordFragment($docx);
         $optionsBlb1 = array(
                'src' => '../../phpGC/'.$img1.'.jpg',
                'imageAlign'=>'center'
          );
$imageBlb1->addImage($optionsBlb1);

then used :

$docx->replaceVariableByWordFragment(array('BLOBA'.$imgCnt => $rowB['BLOB1']), array('type' => 'block'));

to set it in the DOC.

now i need it to be hyperlink to the oginal picure.

is it possible?

iris hadar

Posted by admin  · 13-07-2016 - 15:05

Hello,

Your code is replacing a placeholder by a WordFragment (this is the image) removing the whole content of the paragraph as you are setting replacement type as 'block'.

We recommend you to use inline replacement or use the method replacePlaceholderImage to replace the image.

Regards.