Proble de GD lib

Résolu
cedriclomb Messages postés 275 Date d'inscription samedi 19 novembre 2005 Statut Membre Dernière intervention 27 avril 2010 - 28 mars 2007 à 11:26
coucou747 Messages postés 12303 Date d'inscription mardi 10 février 2004 Statut Membre Dernière intervention 30 juillet 2012 - 29 mars 2007 à 07:55
Bonjour,


Voila un petit probleme, comment ca ce fait que l'image ne s'enregistre
pas dans mon dossier , si je mets null aucun probleme mon image
s'affiche normallement

header("Content-type: image/jpeg");


$source1=$_FILES['pix']['tmp_name'];

$source=imagecreatefromjpeg($source1);

$numero=$_POST['numero'];


$rep_final='../../../borne/Photo/';


//echo $numero ;

//echo $source1;


//hauteur de l'image

$dst_w=223;

$dst_h=171;


$src_w = imagesx ($source);

$src_h = imagesy ($source);


$dst_im = imagecreatetruecolor($dst_w,$dst_h);


//creation de la nouvelle image

imagecopyresized($dst_im,$source,0,0,0,0,$dst_w,$dst_h,$src_w,$src_h);


//envoi dans le repertoire

$fp=fopen('photo.jpg','w');

echo imagejpeg($dst_im, $fp,100);

fclose($fp);

//on vide le cache

imagedestroy($source);

imagedestroy($dst_im);


Merci d'avance

2 réponses

coucou747 Messages postés 12303 Date d'inscription mardi 10 février 2004 Statut Membre Dernière intervention 30 juillet 2012 44
29 mars 2007 à 07:55
Salut,
remplace
$fp=fopen('photo.jpg','w');
echo imagejpeg($dst_im, $fp,100);
fclose($fp);

par

imagejpeg($dst_im, 'photo.jpg',100);

In a dream, I saw me, drop dead... U was there, U cried... It was just a dream, if I die, U won't cry, maybe, U'll be happy

Mon site (articles sur la programmation et programmes)
3
Flachy Joe Messages postés 2103 Date d'inscription jeudi 16 septembre 2004 Statut Membre Dernière intervention 21 novembre 2023 1
28 mars 2007 à 23:46
Si c'est avec echo que tu compte ecrire dans ton fichier, renseigne toi sur fwrite !
Par ailleur imagejpeg envoi directement les données au navigateur, inutile d'utiliser echo.
Finalement :
bool imagejpeg ( resource image [, string filename [, int quality]] )
imagejpeg() envoie l'image GD (<var class="parameter">image</var>)
au format [file:///home/florian/documentation/phpdoc/html/function.imagecreatetruecolor.html imagecreatetruecolor()].

[de la documentation PHP...]

Flachy Joe
0
Rejoignez-nous