0) return "2"; else if (strpos(strtolower($file), ".jpg")) return "1"; else return "3"; } else return "0"; } function imagedeletebackground($pic2,$ro=255,$ve=255,$bl=255) { $pc = 60; $ro = floor($ro/$pc); $ve = floor($ve/$pc); $bl = floor($bl/$pc); $colors_num = imagecolorstotal($pic2); for($i=0;$i<$colors_num;$i++) { $color = imagecolorsforindex($pic2, $i); $r = floor($color["red"]/$pc); $g = floor($color["green"]/$pc); $b = floor($color["blue"]/$pc); if (($r==$ro)&&($g==$ve)&&($b==$bl)) imagecolorset($pic2, $i, 255, 255, 255); } $w = imagecolorallocate($pic2, 255, 255, 255); $trans = imagecolortransparent($pic2, $w); return $pic2; } //------------------------------------------------------------------------ for ($i=0;$i<10;$i++) { if (testit($pic[$i]) == 1) $im[$i] = imagecreatefromjpeg($pic[$i]); else if (testit($pic[$i]) == 2) $im[$i] = imagecreatefrompng($pic[$i]); } if (testit($background) == 1) $img1 = imagecreatefromjpeg($background); else if (testit($background) == 2) $img1 = imagecreatefrompng($background); for ($i=0;$i$height) { $height = imagesy($im[$ch[$i]]); } } $width = $width+$marge*2+$esp*5; $height = $height+$marge*2; $bg = imagecreatetruecolor($width, $height); imagecopyresized($bg,$img1,0,0,0,0,$width,$height,imagesx($img1),imagesy($img1)); $current_x = $marge; for ($i=0;$i> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; $new_im[$i] = imagedeletebackground($im[$ch[$i]],$r,$g,$b); } else $new_im[$i] = $im[$ch[$i]]; imagecopy($bg,$new_im[$i],$current_x,$marge,0,0,imagesx($im[$ch[$i]]),imagesy($im[$ch[$i]])); $current_x += imagesx($im[$ch[$i]])+$esp; } $tailleX=imagesx($bg); $tailleY=imagesy($bg); $rapport=2/3; $newwidth=$tailleX*$rapport; $newheight=$tailleY*$rapport; $img1 = imagecreatetruecolor($newwidth+6, $newheight+6); $couleur = imagecolorallocate($img1, 239, 147, 2); imagefill($img1, 0, 0, $couleur); imagecopyresized($img1,$bg,3,3,0,0,$newwidth,$newheight,$tailleX,$tailleY); imagejpeg($img1); imagedestroy($img1); ?>