Example #1
0
function my_getwidth($l, $tab, $i)
{
    if ($l <= 3) {
        return $l * (return_max_width($tab, $i, $l + $i) + 40);
    } else {
        return (return_max_width($tab, $i, $l + $i) + 40) * 3;
    }
}
Example #2
0
function panel($tab, $e = 0, $l = 12, $tri = FALSE)
{
    if ($tri) {
        sort_array($tab);
    }
    $tabpanel = array();
    $i = 0;
    $nb = 0;
    while ($nb < count($tab) / $l) {
        echo "Veuillez patienter pendant la création des panels...\n";
        $width = my_getwidth($l, $tab, $i) + 40;
        $height = my_getheight($l, $e, $tab, $i) + 40;
        $panel = imagecreatetruecolor($width, $height);
        imagefilledrectangle($panel, 0, 0, $width, $height, 0xffffff);
        $dst_x = 40;
        $dst_y = 40;
        $counter = 0;
        $nm = 0;
        while ($counter < $l && isset($tab[$i])) {
            $im = redim(myimagecreate($tab[$i]), $tab[$i], $e);
            if ($im != 0) {
                $nm++;
                imagecopy($panel, $im, $dst_x, $dst_y, 0, 0, imagesx($im), imagesy($im));
                $dst_x += return_max_width($tab, $i, $i + 3) + 40;
                if ($nm % 3 == 0 && $nm > 0) {
                    $dst_y += return_max_height($tab, $i, $i + 3) + 40;
                    $dst_x = 40;
                }
            }
            $counter++;
            $i++;
        }
        array_push($tabpanel, $panel);
        $nb++;
    }
    return $tabpanel;
}