function crop($img,$des,$largeur=200,$hauteur=200){
par : function crop($img,$des,$l_new,$h_new){
?Concernant l'affichage je l'ai mis en % soit :
echo"<img width='20%' src=".$ligne['photo'].">";
<?PHP
function toto()
{
echo 'dans la fonction toto';
}
?>
Par contre ce code affichera bien quelque chose :
<?PHP
function toto()
{
echo 'dans la fonction toto';
}
toto(); // c'est l'appel de la fonction pour son traitement.
?>
La ligne toto(); fait que le code de la fonction s'exécute. Tu peux même mettre plusieurs lignes comme ca pour qu'elle fasse le traitement plusieurs fois.$dim = getimagesize($repertoire.$nom_fichier);
$max_width = 200;
$max_height = 200;
list($width, $height) = getimagesize($repertoire.$nom_fichier);
$ratioh = $max_height/$height;
$ratiow = $max_width/$width;
$ratio = min($ratioh, $ratiow);
// New dimensions
$width = intval($ratio*$width);
$height = intval($ratio*$height);
switch($dim[2]){
case 2:
$image = imagecreatefromjpeg($repertoire.$nom_fichier);
$resized_image = imagecreatetruecolor($width,$height);
imagecopyresampled($resized_image,$image,0,0,0,0,$width,$height,$dim[0],$dim[1]);
imagejpeg($resized_image,"IMG/photos/mini/perso/".$nom_fichier);
break;
case 1:
$image = imagecreatefromgif($repertoire.$nom_fichier);
$resized_image = imagecreatetruecolor($width,$height);
imagecopyresampled($resized_image,$image,0,0,0,0,$width,$height,$dim[0],$dim[1]);
imagegif($resized_image,"IMG/photos/mini/perso/".$nom_fichier);
break;
case 3:
$image = imagecreatefrompng($repertoire.$nom_fichier);
$resized_image = imagecreatetruecolor($width,$height);
imagecopyresampled($resized_image,$image,0,0,0,0,$width,$height,$dim[0],$dim[1]);
imagepng($resized_image,"IMG/photos/mini/perso/".$nom_fichier);
break;
}