Skip to content

Commit

Permalink
Merge pull request #1967 from jsochor/develop
Browse files Browse the repository at this point in the history
fix image limit
  • Loading branch information
troosan authored Feb 7, 2021
2 parents f5c96be + 26e4794 commit 137238f
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/PhpWord/TemplateProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -633,6 +633,7 @@ 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}" stroked="f"><v:imagedata r:id="{RID}" o:title=""/></v:shape></w:pict>';

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

Expand Down Expand Up @@ -665,6 +666,10 @@ public function setImageValue($search, $replace, $limit = self::MAXIMUM_REPLACEM
// replace on each iteration, because in one tag we can have 2+ inline variables => before proceed next variable we need to change $partContent
$partContent = $this->setValueForPart($wholeTag, $replaceXml, $partContent, $limit);
}

if (++$i >= $limit) {
break;
}
}
}
}
Expand Down

0 comments on commit 137238f

Please sign in to comment.