function finalSize($output, $docValide, $argv) { $j = 0; $compteur = 1; $posx = 0; $posy = 0; $hauteurTot = 0; while (isset($output[1][$j])) { $insert = traitementImg($docValide, $output[1][$j], $argv); if (isset($insert) && $insert != false) { $coeff = imagesx($insert) / 395; $hauteur = imagesy($insert) / $coeff; $hauteurTot = $hauteurTot + $hauteur; $compteur++; } $j++; } $hauteurFinale = (intval($hauteurTot) + 1) / 4; return $hauteurFinale; }
<?php $j = 0; $compteur = 1; $posx = 0; $posy = 0; $hauteurTot = 0; $imageFinale = imagecreatetruecolor(1600, $hauteurFinale + 500); while (isset($output[1][$j])) { $insert = traitementImg($docValide, $output[1][$j], $argv[$i]); if (isset($insert) && $insert != false) { $coeff = imagesx($insert) / 395; $hauteur = imagesy($insert) / $coeff; $noir = imageColorAllocate($insert, 255, 255, 255); preg_match("/([^.\\/]*)[.]?[^.\\/]*\$/", $output[1][$j], $noms); imagecopyresized($imageFinale, $insert, $posx, $posy, 0, 0, 395, $hauteur, imagesx($insert), imagesy($insert)); if ($fusion[0] == '0' || $fusion[0] == '1') { $fusion[0] = intval($fusion[0]); $imgTexte = imagecreatetruecolor(395, 20); imageString($imgTexte, 5, 0, 0, $noms[$fusion[0]], $noir); imagecopyresized($imageFinale, $imgTexte, $posx, $posy + $hauteur, 0, 0, 395, 30, 395, 30); $posy = $posy + $hauteur + 25; } else { $posy = $posy + $hauteur + 5; } if ($hauteurTot + $hauteur > $hauteurFinale) { $posy = 0; $posx = $posx + 400; $hauteurTot = 0; } else { $hauteurTot = $hauteurTot + $hauteur;