Skip to content

Commit f7242e1

Browse files
committed
fix image limit
1 parent ec1b3d3 commit f7242e1

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
@@ -577,6 +577,7 @@ public function setImageValue($search, $replace, $limit = self::MAXIMUM_REPLACEM
577577
// result can be verified via "Open XML SDK 2.5 Productivity Tool" (http://www.microsoft.com/en-us/download/details.aspx?id=30425)
578578
$imgTpl = '<w:pict><v:shape type="#_x0000_t75" style="width:{WIDTH};height:{HEIGHT}"><v:imagedata r:id="{RID}" o:title=""/></v:shape></w:pict>';
579579

580+
$i = 0;
580581
foreach ($searchParts as $partFileName => &$partContent) {
581582
$partVariables = $this->getVariablesForPart($partContent);
582583

@@ -609,6 +610,10 @@ public function setImageValue($search, $replace, $limit = self::MAXIMUM_REPLACEM
609610
// replace on each iteration, because in one tag we can have 2+ inline variables => before proceed next variable we need to change $partContent
610611
$partContent = $this->setValueForPart($wholeTag, $replaceXml, $partContent, $limit);
611612
}
613+
$i++;
614+
if($i >= $limit) {
615+
break;
616+
}
612617
}
613618
}
614619
}

0 commit comments

Comments
 (0)