Image !!

Résolu
cs_Dfx4 Messages postés 31 Date d'inscription dimanche 17 avril 2005 Statut Membre Dernière intervention 27 février 2006 - 30 sept. 2005 à 13:23
cs_Anthomicro Messages postés 9433 Date d'inscription mardi 9 octobre 2001 Statut Membre Dernière intervention 13 avril 2007 - 30 sept. 2005 à 17:55
Bonjour,



j'ai petit problème avec les images, certain images qui viennent de MMS
ne fonctionnne pas, cela me rend un carré noir !! Il copie pas l'image
de quoi cela peut-il venir ??



Aidez-moi SVP !!!!



function move_pict($src, $name) {

global $MM, $INFO, $DB, $SESS;



// Recherche du type de l'image et de l'extension

$ext = strtolower(strrchr($name, '.'));



if( !file_exists($src) ) return 'not found file';



if( !in_array($ext, explode('!', $INFO['accept_ext'])) ) return 'bad extension';

else {




// Type de fichier reconnu || 1 GIF, 2 JPG,
JPEG, 3 = PNG


if( list( $width, $height, $type, $opt ) =
getimagesize($src) ) {




// Si le type n'est pas GIF, JPG,
PNG


if( $type > 3 ) return 'bad
format';

else {







// Création du dossier



if( !$dh =
@opendir(RACINE."missmobiles/photos/".$SESS->user_id) ) {







if(
!mkdir(RACINE."missmobiles/photos/".$SESS->user_id) ) return 'not
dir';



}







// Taille maximum



list( $max_width,
$max_height )
= explode('x', $INFO['pict_size_b']);



list( $max_width_small, $max_height_small )
= explode('x', $INFO['pict_size_s']);







// Calcul des tailes



if( $width >= $height ) {







if( $width > $max_width ) {








$big_width = $max_width;



$propB
= $width/$max_width;



$big_height =
ceil($height/$propB)-1;







}







if( $width > $max_width_small
) {








$small_width = $max_width_small;



$propS
=
$width/$max_width_small;



$small_height
= ceil($height/$propS)-1;







}







}



else {







if( $height > $max_height ) {








$big_height = $max_height;



$propB
= $height/$max_height;



$big_width
= ceil($width/$propB)-1;







}







if( $height >
$max_height_small ) {







$small_height
= $max_height_small;



$propS
=
$height/$max_height_small;



$small_width
= ceil($width/$propS)-1;







}







}







// Si plus petit que les tailles enregsitrée



if( $width < $max_width && $height <
$max_height ) {







$big_width =
$width;



$big_height = $height;



}







if( $width < $max_width_small && $height
< $max_height_small ) {







$small_width = $width;



$small_height = $height;



}







// Création de l'image



$big_pict = imagecreatetruecolor(
$big_width, $big_height );



$small_pict = imagecreatetruecolor( $small_width,
$small_height );











// Création d'une image avec l'ancien contenue par
rapport au type



switch( $type ) {







case 1 : $pict =
@imagecreatefromgif($src); break;



case 2 : $pict =
@imagecreatefromjpeg($src); break;



case 3 : $pict =
@imagecreatefrompng($src); break;







default : return 'bad format';



}







// Copie du contenue



@imagecopyresized($big_pict, $pict, 0,0,0,0,
$big_width, $big_height, $width, $height);



@imagecopyresized($small_pict, $pict, 0,0,0,0,
$small_width, $small_height, $width, $height);







// Création des images



@imagejpeg($big_pict, RACINE."missmobiles/photos/".
$SESS->user_id ."/big.jpg", 100);



@imagejpeg($small_pict,
RACINE."missmobiles/photos/". $SESS->user_id ."/small.jpg", 100);







// Suppresion du file temporaire



// unlink($src);







return false;





}

}

else return 'bad format';



}



return 'error';

}

8 réponses

cs_Anthomicro Messages postés 9433 Date d'inscription mardi 9 octobre 2001 Statut Membre Dernière intervention 13 avril 2007 8
30 sept. 2005 à 17:55
bah t'ouvre ça sous gimp alors :-) et n'oublie pas d'attribuer les droits de lecture et écriture pour le fichier concerné

<hr size="2" width="100%"><li>Entraide, dépannage et vulgarisation informatique : Mon site de vulgarisation informatique</li>
3
cs_Dfx4 Messages postés 31 Date d'inscription dimanche 17 avril 2005 Statut Membre Dernière intervention 27 février 2006
30 sept. 2005 à 15:36
J'ai ça comme erreur avec !!

<!--StartFragment --> Warning: imagecreatefromjpeg(): './missmobiles/tmp/62/Marie.jpg' is not a valid JPEG file in /home/www/36e12c46cf945a186c750d3711b9c7e3/web/sys_vote/sources/functions.php on line 321
0
cs_Anthomicro Messages postés 9433 Date d'inscription mardi 9 octobre 2001 Statut Membre Dernière intervention 13 avril 2007 8
30 sept. 2005 à 15:55
Salut,



ça signifie que soit ton image n'existe pas, soit ce n'est pas une
image jpeg (regarde donc comment tu l'as sauvegardée auparavant)

<hr size="2" width="100%"><li>Entraide, dépannage et vulgarisation informatique : Mon site de vulgarisation informatique</li>
0
cs_Dfx4 Messages postés 31 Date d'inscription dimanche 17 avril 2005 Statut Membre Dernière intervention 27 février 2006
30 sept. 2005 à 16:25
L'image existe et c'est une image JPEG !! Comprends vraiment pas !! Je peux la visionnet sur mon PC !!
0

Vous n’avez pas trouvé la réponse que vous recherchez ?

Posez votre question
cs_Anthomicro Messages postés 9433 Date d'inscription mardi 9 octobre 2001 Statut Membre Dernière intervention 13 avril 2007 8
30 sept. 2005 à 16:44
bah ce n'est pas un jpeg valide. Tente de l'ouvrir et de l'enregistrer avec un éditeur d'images, ça devrait fonctionner

<hr size="2" width="100%"><li>Entraide, dépannage et vulgarisation informatique : Mon site de vulgarisation informatique</li>
0
cs_Dfx4 Messages postés 31 Date d'inscription dimanche 17 avril 2005 Statut Membre Dernière intervention 27 février 2006
30 sept. 2005 à 16:47
Ouai c'est ça le message, une image JPEG non valide !!



Un éditeur d'image ?? Dis moi plus ?
0
cs_Anthomicro Messages postés 9433 Date d'inscription mardi 9 octobre 2001 Statut Membre Dernière intervention 13 avril 2007 8
30 sept. 2005 à 17:00
bah tu ouvres ton image avec paint par exemple, et tu la réenregistres en jpeg

<hr size="2" width="100%"><li>Entraide, dépannage et vulgarisation informatique : Mon site de vulgarisation informatique</li>
0
cs_Dfx4 Messages postés 31 Date d'inscription dimanche 17 avril 2005 Statut Membre Dernière intervention 27 février 2006
30 sept. 2005 à 17:20
Ah vi sous windows !!! Mais moi mon système doit etre auto et sa fonctionne sous Linux, sa me parvient d'un MMS !!
0
Rejoignez-nous