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; }
function boucleImage($texte, $args) { // récupération des arguments $produit = lireTag($args, "produit", "int"); $id = lireTag($args, "id", "int"); $num = lireTag($args, "num", "int"); $nb = lireTag($args, "nb", "int"); $debut = lireTag($args, "debut", "int"); $deb = lireTag($args, "deb", "int"); $rubrique = lireTag($args, "rubrique", "int"); $largeur = lireTag($args, "largeur", "int"); $hauteur = lireTag($args, "hauteur", "int"); $dossier = lireTag($args, "dossier", "int"); $contenu = lireTag($args, "contenu", "int"); $opacite = lireTag($args, "opacite", "int"); $noiretblanc = lireTag($args, "noiretblanc", "int"); $miroir = lireTag($args, "miroir", "int"); $aleatoire = lireTag($args, "aleatoire", "int"); $exclusion = lireTag($args, "exclusion", "int_liste"); $exact = lireTag($args, "exact", "int"); $couleurfond = lireTag($args, "couleurfond", "string"); $source = lireTag($args, "source", "string"); $search = ""; $res = ""; $limit = ""; if ($deb != "") { $debut = $deb; } if ($aleatoire) { $order = "order by " . " RAND()"; } else { $order = " order by classement"; } if ($source != '') { $search .= " and {$source}=" . intval($id); } else { if ($id != "") { $search .= " and id=\"{$id}\""; } if ($produit != "") { $search .= " and produit=\"{$produit}\""; } if ($rubrique != "") { $search .= " and rubrique=\"{$rubrique}\""; } if ($dossier != "") { $search .= " and dossier=\"{$dossier}\""; } if ($contenu != "") { $search .= " and contenu=\"{$contenu}\""; } } if ($exclusion != "") { $search .= " and id not in({$exclusion})"; } $image = new Image(); if ($debut != "") { $debut--; } else { $debut = 0; } $query = "select * from {$image->table} where 1 {$search}"; if ($debut != "" && $num == "") { $num = CacheBase::getCache()->query_count($query); } if ($debut != "" || $num != "") { $limit .= " limit {$debut},{$num}"; } if ($nb != "") { $nb--; $limit .= " limit {$nb},1"; } $query = "select * from {$image->table} where 1 {$search} {$order} {$limit}"; $pr = new Produit(); $prdesc = new Produitdesc(); $rudesc = new Rubriquedesc(); $contenudesc = new Contenudesc(); $dossierdesc = new Dossierdesc(); $compt = 1; $result = CacheBase::getCache()->query($query); if ($result == "" || count($result) == 0) { return ""; } foreach ($result as $row) { $image = new Image(); $image->charger($row->id); $imagedesc = new Imagedesc(); $imagedesc->charger($image->id); $temp = $texte; // Compatibilité $temp = str_replace("#FGRANDE", "#FICHIER", $temp); $temp = str_replace("#FPETITE", "#FICHIER", $temp); $temp = str_replace("#GRANDE", "#IMAGE", $temp); $temp = str_replace("#PETITE", "#IMAGE", $temp); if ($image->produit != 0) { $type = "produit"; $pr->charger_id($image->produit); $prdesc->charger($image->produit); $temp = str_replace("#PRODTITRE", $prdesc->titre, $temp); $temp = str_replace("#PRODUIT", $image->produit, $temp); $temp = str_replace("#PRODREF", $pr->ref, $temp); $temp = str_replace("#RUBRIQUE", $pr->rubrique, $temp); } else { if ($image->rubrique != 0) { $type = "rubrique"; $rudesc->charger($image->rubrique); $temp = str_replace("#RUBRIQUE", $image->rubrique, $temp); $temp = str_replace("#RUBTITRE", $rudesc->titre, $temp); } else { if ($image->dossier != 0) { $type = "dossier"; $dosdesc = new Dossierdesc(); $dosdesc->charger($image->dossier); $temp = str_replace("#DOSSIER", $image->dossier, $temp); $temp = str_replace("#DOSTITRE", $dosdesc->titre, $temp); } else { if ($image->contenu != 0) { $type = "contenu"; $ctdesc = new Contenudesc(); $ctdesc->charger($image->contenu); $temp = str_replace("#CONTTITRE", $ctdesc->titre, $temp); $temp = str_replace("#CONTENU", $image->contenu, $temp); } } } } if ($type != "") { $nomcache = redim($type, $image->fichier, $largeur, $hauteur, $opacite, $noiretblanc, $miroir, 1, $exact, $couleurfond); if (!$largeur && !$hauteur) { $temp = str_replace("#IMAGE", "client/gfx/photos/{$type}/" . $image->fichier, $temp); } else { $temp = str_replace("#IMAGE", $nomcache, $temp); } $temp = str_replace("#FICHIER", "client/gfx/photos/{$type}/" . $image->fichier, $temp); } $temp = str_replace("#ID", $image->id, $temp); $temp = str_replace("#TITRE", $imagedesc->titre, $temp); $temp = str_replace("#CHAPO", $imagedesc->chapo, $temp); $temp = str_replace("#DESCRIPTION", $imagedesc->description, $temp); $temp = str_replace("#COMPT", "{$compt}", $temp); $temp = str_replace("#NOMCACHE", "{$nomcache}", $temp); $temp = str_replace("#CACHE", "{$nomcache}", $temp); $compt++; $res .= $temp; } return $res; }
/* along with this program. If not, see <http://www.gnu.org/licenses/>. */ /* */ /*************************************************************************************/ require_once __DIR__ . "/error_reporting.php"; // redimensionnement des images + effets require_once __DIR__ . "/divers.php"; // Déclaration des variables $vars = array('type', 'nomorig', 'height', 'width', 'opacite', 'nb', 'miroir', 'exact', 'couleurfond'); foreach ($vars as $var) { if (isset($_REQUEST[$var])) { ${$var} = $_REQUEST[$var]; } else { ${$var} = ''; } } $nomcache = redim($type, $nomorig, $width, $height, $opacite, $nb, $miroir, 1, $exact, $couleurfond); if ($nomcache != '' && preg_match("/([^\\/]*).((jpg|gif|png|jpeg))/i", $nomorig, $nsimple)) { switch (strtolower($nsimple[2])) { case "gif": header("Content-type: image/gif"); break; case "jpg": case "jpeg": header("Content-type: image/jpeg"); break; case "png": header("Content-type: image/png"); break; default: exit; }