Miniatures
Posté : 18 nov. 2008, 13:02
Bonjour,
Je me sers pour afficher mes images d'une fonction pour les redimensionner.
Or j'ai un message comme quoi la fonction n'est pas reconnu
Fatal error: Call to undefined function thumbail()
Que se passe t'il
Merci pour votre aide
Mon Code :
Je me sers pour afficher mes images d'une fonction pour les redimensionner.
Or j'ai un message comme quoi la fonction n'est pas reconnu
Fatal error: Call to undefined function thumbail()
Que se passe t'il
Merci pour votre aide
Mon Code :
<?php
echo("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n");
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fr" lang="fr">
<head>
<link href="librairie/CSS/style_instit.css" rel="stylesheet" type="text/css" />
<SCRIPT LANGUAGE="javascript">
compteur=0;
function tourne(){
if (compteur == 9)
{
compteur = 1;
}
else
{
compteur++;
}
document.composite.src="librairie/composite/Composite" + compteur + ".jpg";
setTimeout('tourne()', 3000);
}
function thumbail($file, $maxWidth, $maxHeight){
$img = ImageCreateFromJpeg("$file");
//Dimensions de l'image
$imgWidth = imagesx($img);
$imgHeight = imagesy($img);
//Facteur largeur/hauteur des dimensions max
$whFact = $maxWidth/$maxHeight;
//Facteur largeur/hauteur de l'original
$imgWhFact = $imgWidth/$imgHeight;
//fixe les dimensions du thumb
if($whFact < $imgWhFact){//Si largeur déterminante
$thumbWidth = $maxWidth;
$thumbHeight = $thumbWidth/$imgWhFact;
} else { //Si hauteur déterminante
$thumbHeight = $maxHeight;
$thumbWidth = $thumbHeight*$imgWhFact;
}
//Crée le thumb (image réduite)
$imgThumb = ImageCreateTruecolor($thumbWidth, $thumbHeight);
//Insère l'image de base redimensionnée
ImageCopyResized($imgThumb, $img, 0, 0, 0, 0, $thumbWidth, $thumbHeight, $imgWidth, $imgHeight);
//Nom du fichier thumb
$imgThumbName = "thumb_".$file;
//Crée le fichier thumb
$fp = fopen($imgThumbName, "w");
fclose($fp);
//Renvoie le thumb créé
ImageJpeg($imgThumb, $imgThumbName);
return $imgThumbName;
}
</SCRIPT>
</head>
<body onload="tourne();">
<div id="site">
<?php
$pageName = "Accueil";
include ("./templates/haut.php");
?>
<div id="Coeur">
<!-- Titre d'un article -->
<h1>CQFD Image vous propose afin de promouvoir votre société de façon efficace et moderne différents moyens de la mettre en valeur sur le plan visuel (photo, vidéo et multimedia).</h1>
<!-- Début des articles , partie de droite -->
<div id="illustrations">
<div id="images">
<!-- Centre de la Feuille -->
<table align="center" cellspacing="0" cellpadding="0" >
<!-- Photos -->
<tr align="center">
<td>
<img id="composite" name="composite" alt="Composite"/>
<?php
thumbail(composite, 420, 420);
?>
</td>
</tr>
</table>
<!-- Fin des illustrations -->
</div>
<?php
include ("templates/bas.php");
?>
<!-- Fin du div coeur -->
</div>
<!-- Fin du div site -->
</div>
</body>
</html>