Php imagejpg affichage sur un browser

Résolu
swedikiluka Messages postés 42 Date d'inscription samedi 19 mars 2005 Statut Membre Dernière intervention 22 février 2010 - 12 nov. 2009 à 11:12
swedikiluka Messages postés 42 Date d'inscription samedi 19 mars 2005 Statut Membre Dernière intervention 22 février 2010 - 13 nov. 2009 à 07:25
Bonjour à tous,j'ai copié le code trouver sur le site de php http://fr2.php.net/manual/fr/function.imagejpeg.php:
<?php

function miniature($pict, $dest_pict){

$handle = @imagecreatefromjpeg($pict);

$x=imagesx($handle);
$y=imagesy($handle);

if($x > $y){
$max = $x;
$min = $y;
}
if($x <= $y){
$max = $y;
$min = $x;
}

//$size_in_pixel : Size max of the label in pixel. The size of the picture being
//proportional to the original, this value define maximum size
//of largest side with dimensions of the picture. Sorry for my english !

//Here $size_in_pixel = 100 for a thumbnail.
$size_in_pixel = '100';

$rate = $max/$size_in_pixel;
$final_x = $x/$rate;
$final_y = $y/$rate;

if($final_x > $x) {
$final_x = $x;
$final_y = $y;
}

$final_x = ceil($final_x);
$final_y = ceil($final_y);

$black_picture = imageCreatetruecolor($final_x,$final_y);
imagefill($black_picture,0,0,imagecolorallocate($black_picture, 255, 255, 255));
imagecopyresampled($black_picture, $handle, 0, 0, 0, 0,$final_x, $final_y, $x, $y);

if(!@imagejpeg($black_picture,$dest_pict.'/mini_'.$pict, $size_in_pixel))
imagestring($black_picture, 1, $final_x-4, $final_y-8, ".", imagecolorallocate($black_picture,0,0,0));

//The number is the quality of the result picture
imagejpeg($black_picture,'', '100');
imagedestroy($handle);
imagedestroy($black_picture);
}

$pict = "PICT7024.jpg";
$dest_pict = "D:/Program Files/EasyPHP1-7/www/test";
miniature($pict, $dest_pict);

?>
Quand j'execute ce code en mettant NULL ou '' à imagejpeg($black_picture,'', '100') il m'affiche de caractère bizzares.
Quelqu'un a une idée de l'erreur due à cet affichage.
merci

1 réponse

swedikiluka Messages postés 42 Date d'inscription samedi 19 mars 2005 Statut Membre Dernière intervention 22 février 2010
13 nov. 2009 à 07:25
Bonjour tout le monde,
j'ai fini par trouver.Il suffisait de créer un fichier(compression.php) à part dans le quel on écrit ce script et donner dans un autre fichier(album.php)l'image qui sera affichée se trouve dans l'album.php
alors la source de l'image
Merci bien
PROBLEME RESOLU
3
Rejoignez-nous