Skip to content

Commit 137238f

Browse files
authored
Merge pull request #1967 from jsochor/develop
fix image limit
2 parents f5c96be + 26e4794 commit 137238f

File tree

1 file changed

+5
-0
lines changed

1 file changed

+5
-0
lines changed

src/PhpWord/TemplateProcessor.php

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -633,6 +633,7 @@ public function setImageValue($search, $replace, $limit = self::MAXIMUM_REPLACEM
633633
// result can be verified via "Open XML SDK 2.5 Productivity Tool" (http://www.microsoft.com/en-us/download/details.aspx?id=30425)
634634
$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>';
635635

636+
$i = 0;
636637
foreach ($searchParts as $partFileName => &$partContent) {
637638
$partVariables = $this->getVariablesForPart($partContent);
638639

@@ -665,6 +666,10 @@ public function setImageValue($search, $replace, $limit = self::MAXIMUM_REPLACEM
665666
// replace on each iteration, because in one tag we can have 2+ inline variables => before proceed next variable we need to change $partContent
666667
$partContent = $this->setValueForPart($wholeTag, $replaceXml, $partContent, $limit);
667668
}
669+
670+
if (++$i >= $limit) {
671+
break;
672+
}
668673
}
669674
}
670675
}

0 commit comments

Comments
 (0)