You have struck a nail! The way that the HTML generation behaves is by a PHP loop that grabs a photo and text from a set serialized HTML files that are hosted remotely. So to generate the HTML, I have a form that you give a CSV of numerical values and it kicks back this report with the photos and descriptions.
To answer your question, the same images (2 of 10) fails no matter the order of the elements.
Here is the code that generates the $pageContents with some secret parts taken out:
<?php
$pageContents = NULL;
$photoIDs=$_POST["photoIDs"];
$photoIDarray=explode(",",$photoIDs);
//print_r($photoIDarray);
$pageContents = "<div class='header'><h1>".$_POST["reportTitle"]."</h1><p>".$_POST["notes"]."</p></div>";
for ($i = 0; $i < count($photoIDarray); ++$i) {
//print $photoIDarray[$i];
$contentID = $photoIDarray[$i];
//echo "Content ID: ".$contentID;
if ($contentID{0} != "L"){
if(preg_match('/<h1>(.+)<\/h1>/', $contents, $title));
if(preg_match('/<img class\=\"inset\" src\=\"(.+)\" alt=/', $contents, $thumb));
if(preg_match('/<\/span><\/p>(.*)<p class/msU', $contents, $desc));
}
$pageContents .= "<div class='item'><div class='photo'><a href='".$linkURL."' target='_blank'><img src='".$photoSrc."'/></a></div>";
$pageContents .= "<div class='text'><h2>".$title[1]."</h2>";
$pageContents .= $desc[1];
$pageContents .= "</div></div>";
}
?>
<body>
<div style="position:fixed; right:10px; top:15px;">
<form action="genPDF.php" method="post">
<input type="hidden" id="pageContents" name="pageContents" value="<?php echo $pageContents;?>" />
<input type="submit" value="Generate PDF" style="height: 80px; width: 200px; font-size:16px; background-color:#0000ff; color:#fff;" />
</form>
</div>
<div class="all">
<?php
echo $pageContents;
?>