Skip to content

Commit

Permalink
Merge f6b8d3e into 733f845
Browse files Browse the repository at this point in the history
  • Loading branch information
FireworksWebsites committed Dec 15, 2019
2 parents 733f845 + f6b8d3e commit f304a41
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions src/PhpWord/TemplateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -577,6 +577,8 @@ public function setImageValue($search, $replace, $limit = self::MAXIMUM_REPLACEM
// result can be verified via "Open XML SDK 2.5 Productivity Tool" (http://www.microsoft.com/en-us/download/details.aspx?id=30425)
$imgTpl = '<w:pict><v:shape type="#_x0000_t75" style="width:{WIDTH};height:{HEIGHT}"><v:imagedata r:id="{RID}" o:title=""/></v:shape></w:pict>';

$replaced = 0;

foreach ($searchParts as $partFileName => &$partContent) {
$partVariables = $this->getVariablesForPart($partContent);

Expand All @@ -586,6 +588,10 @@ public function setImageValue($search, $replace, $limit = self::MAXIMUM_REPLACEM
});

foreach ($varsToReplace as $varNameWithArgs) {
if ($limit >= 0 && $replaced >= $limit) {
return;
}

$varInlineArgs = $this->getImageArgs($varNameWithArgs);
$preparedImageAttrs = $this->prepareImageAttrs($replaceImage, $varInlineArgs);
$imgPath = $preparedImageAttrs['src'];
Expand Down

0 comments on commit f304a41

Please sign in to comment.