Précédent   Forum des professionnels en informatique > PHP > Outils > EasyPHP
EasyPHP Forum d'entraide sur EasyPHP : installation, utilisation, etc. Avant de poster -> Cours EasyPHP
Partagez cette discussion sur d'autres réseaux sociaux : Viadeo Twitter Google Facebook Digg Delicious MySpace Yahoo
Réponse Proposer ce sujet en actualité
 
Outils de la discussion
Publicité
'
Vieux 09/09/2007, 18h05   #1
Invité de passage
 
Inscription : décembre 2006
Messages : 6
Détails du profil
Informations forums :
Inscription : décembre 2006
Messages : 6
Points : 2
Points : 2
Par défaut Mes images en PHP ne s'affichent plus en local depuis mise à jour easyphp 1.8

Bonjours a tous,
Une mise a jour de EasyPhp 1.8 c'est faite sur mon PC et depuis mon code pour afficher mes photos avec l'intégration d'un logo dessus et un texte ne marche plus, enfin ne retourne plus d'image et je n'est aucun message d'erreur.
Cependant ce même code marche sur mon site en ligne.
Ne sachant pas ou rechercher vu qu'aucun message d'erreur n'apparait, est que quelqu'un aurait un indice ou une solution a me proposé
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
 
<?php
require_once("bdd.php");
if(session_is_registered("login")) { 
    $pseudo     = $_SESSION['login'] ;
    $id_gal     = $_GET['id_gal'];
    $id_photo     = $_GET['id_photo'];
    $font         = './arial.ttf';
    //$font2     = './baloney_.ttf';
    //$font3     = './vladimir.ttf';
 
    //on recupere le repertoire des photo
    $sql_rep1 = "SELECT dossier_album FROM galerie WHERE id='$id_gal'"; 
    $req_rep1 = mysql_query($sql_rep1) or die('Erreur SQL !<br>'.$sql_re1p.'<br>'.mysql_error()); 
    $data_rep1 = mysql_fetch_array($req_rep1);
    $repertoire = $data_rep1['dossier_album'];
    //on recupere l'image
    $sql_photo1 = "SELECT photo,vue FROM galerie WHERE id='$id_photo'"; 
    $req_photo1 = mysql_query($sql_photo1) or die('Erreur SQL !<br>'.$sql_photo1.'<br>'.mysql_error()); 
    $data_photo1 = mysql_fetch_array($req_photo1);
    $lien_image = "images/photos/".$repertoire."/".$data_photo1['photo'];
 
    header ("Content-type: image/jpeg"); // L'image que l'on va créer est un jpeg
 
    // On charge d'abord les images
    $source                 = imagecreatefrompng("images/divers/logo.png"); // Le logo est la source
    $destination             = imagecreatefromjpeg($lien_image); // La photo est la destination
 
    // variable pour le texte de l image
    $rouge                     = imagecolorallocate($destination, 255, 0, 0);
    $blanc                     = imagecolorallocate($destination, 255, 255, 255);
    $grey                     = imagecolorallocate($destination, 128, 128, 128);
    $black                     = imagecolorallocate($destination, 0, 0, 0);
 
    $text_vue                = "Photo Vue $data_photo1[vue] fois";
    $text                    = "Axel - Photo Album";
    $ref                    = $id_photo."".$id_gal."_".$repertoire."_".$data_photo1['photo'];
    $extention                 = array(".JPG", ".jpg", ".jpeg", ".JPEG");
    $ref                     = str_replace($extention, "", $ref);
    $autorisation            = "Autorisation d'affichage accordé à $pseudo";
    $identification            = "N° d'autorisation : ".date("Ymd").".$ip.".date("siH") ;
 
    // Les fonctions imagesx et imagesy renvoient la largeur et la hauteur d'une image
    $largeur_source         = imagesx($source);
    $hauteur_source         = imagesy($source);
    $largeur_destination     = imagesx($destination);
    $hauteur_destination     = imagesy($destination);
 
    // On veut placer le logo en bas à droite, on calcule les coordonnées où on doit placer le logo sur la photo
    $destination_x             = $largeur_destination - $largeur_source;
    $destination_y             = $hauteur_destination - $hauteur_source;
 
    // On met le logo (source) dans l'image de destination (la photo)
    imagecopymerge($destination, $source, $destination_x, $destination_y, 0, 0, $largeur_source, $hauteur_source, 50);
    // On ecrit sur l image
    imagettftext($destination, 12, 0, 14, 15, $black, $font, $autorisation);
    imagettftext($destination, 12, 0, 16, 15, $black, $font, $autorisation);
    imagettftext($destination, 12, 0, 15, 14, $black, $font, $autorisation);
    imagettftext($destination, 12, 0, 15, 16, $black, $font, $autorisation);
    imagettftext($destination, 12, 0, 15, 15, $blanc, $font, $autorisation);
 
    imagettftext($destination, 12, 0, 15, 29, $black, $font, $ref);
    imagettftext($destination, 12, 0, 15, 31, $black, $font, $ref);
    imagettftext($destination, 12, 0, 14, 30, $black, $font, $ref);
    imagettftext($destination, 12, 0, 16, 30, $black, $font, $ref);
    imagettftext($destination, 12, 0, 15, 30, $blanc, $font, $ref);
 
    imagettftext($destination, 12, 0, 15, 44, $black, $font, $identification);
    imagettftext($destination, 12, 0, 15, 46, $black, $font, $identification);
    imagettftext($destination, 12, 0, 14, 45, $black, $font, $identification);
    imagettftext($destination, 12, 0, 16, 45, $black, $font, $identification);
    imagettftext($destination, 12, 0, 15, 45, $blanc, $font, $identification);
 
    imagettftext($destination, 12, 0, 15, 59, $blanc, $font, $text_vue);
    imagettftext($destination, 12, 0, 15, 61, $blanc, $font, $text_vue);
    imagettftext($destination, 12, 0, 14, 60, $blanc, $font, $text_vue);
    imagettftext($destination, 12, 0, 16, 60, $blanc, $font, $text_vue);
    imagettftext($destination, 12, 0, 15, 60, $rouge, $font, $text_vue);
 
    imagettftext($destination, 40, 0, 15, $hauteur_destination - 10, $blanc, $font, "N°".$id_photo);
    //imagestring($destination, 3, 15, $hauteur_destination - 20 ,$ref, $blanc); 
    //imagestring($destination, 3, 15, $hauteur_destination - 30 ,$text_vue, $blanc); 
 
    // On affiche l'image final
    imagejpeg($destination);
    imagedestroy($destination);
 
}
?>
Merci d'avance de votre aide.
Amicalement.
Iro.
Iro87 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/09/2007, 18h26   #2
En attente de confirmation mail
 
Inscription : juin 2002
Messages : 6 164
Détails du profil
Informations forums :
Inscription : juin 2002
Messages : 6 164
Points : 6 404
Points : 6 404
Quelle partie n'est pas exécutée précisément ? L'ensemble du if que vous donnez ?

Par contre, il n'y a pas de session_start dans votre code a priori et session_is_registered est dépréciée (isset($_SESSION['login'])).
julp est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/09/2007, 18h48   #3
Invité de passage
 
Inscription : décembre 2006
Messages : 6
Détails du profil
Informations forums :
Inscription : décembre 2006
Messages : 6
Points : 2
Points : 2
Citation:
Envoyé par julp Voir le message
Quelle partie n'est pas exécutée précisément ? L'ensemble du if que vous donnez ?

Par contre, il n'y a pas de session_start dans votre code a priori et session_is_registered est dépréciée (isset($_SESSION['login'])).
Tout le code je pense car en faite dans la page d'origine si il n'est pas connecter cela retourne une autre image

pour le session_start il est dans
Code :
<?php require_once("bdd.php"); ?>
voici le code entier de la page (je l'avais abreger pour simplifer la lecture)
Code :
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
<?php
require_once("bdd.php");
if(session_is_registered("login")) { 
    $pseudo     = $_SESSION['login'] ;
    $id_gal     = $_GET['id_gal'];
    $id_photo     = $_GET['id_photo'];
    $font         = './arial.ttf';
    //$font2     = './baloney_.ttf';
    //$font3     = './vladimir.ttf';
 
    //on verifie si il n'y a pas de bloquage PERSONALISER pour afficher cette photo
    $sql_blok = "SELECT pseudo FROM galerie WHERE type='BLOK' AND nom_album='$id_gal' AND pseudo='$login'"; 
    $req_blok = mysql_query($sql_blok) or die('Erreur SQL !<br>'.$sql_blok.'<br>'.mysql_error()); 
    $res_blok = mysql_numrows($req_blok);     
    if($res_blok != 0 ){ 
        header ("Content-type: image/png");
        $im = ImageCreate (800, 600) or die ("Erreur lors de la création de l'image");        
        $couleur_fond = ImageColorAllocate ($im, 255, 0, 0);
        // variable pour le texte de l image
        $blanc         = imagecolorallocate($im, 255, 255, 255);
        $grey         = imagecolorallocate($im, 128, 128, 128);
        $black         = imagecolorallocate($im, 0, 0, 0);
 
 
        imagettftext($im, 50, 0, 110, 100, $blanc, $font, "ACCES INTERDIT");
        imagettftext($im, 20, 0, 80, 150, $black, $font, "Désolé $login, Malgré ton Acces au site");
        imagettftext($im, 20, 0, 60, 180, $black, $font, "cette galerie et toutes les photos qu'elle contient");
        imagettftext($im, 20, 0, 200, 250, $black, $font, "ne te sont pas autorisé !!!");
 
        //on cree l'image
        ImagePng ($im); 
        //on detruit l image de la memoir serveur
        imagedestroy($im);
        exit;
    }
 
    //on recupere le repertoire des photo
    $sql_rep1 = "SELECT dossier_album FROM galerie WHERE id='$id_gal'"; 
    $req_rep1 = mysql_query($sql_rep1) or die('Erreur SQL !<br>'.$sql_re1p.'<br>'.mysql_error()); 
    $data_rep1 = mysql_fetch_array($req_rep1);
    $repertoire = $data_rep1['dossier_album'];
    //on recupere l'image
    $sql_photo1 = "SELECT photo,vue FROM galerie WHERE id='$id_photo'"; 
    $req_photo1 = mysql_query($sql_photo1) or die('Erreur SQL !<br>'.$sql_photo1.'<br>'.mysql_error()); 
    $data_photo1 = mysql_fetch_array($req_photo1);
    $lien_image = "images/photos/".$repertoire."/".$data_photo1['photo'];
 
    header ("Content-type: image/jpeg"); // L'image que l'on va créer est un jpeg
 
    // On charge d'abord les images
    $source                 = imagecreatefrompng("images/divers/logo.png"); // Le logo est la source
    $destination             = imagecreatefromjpeg($lien_image); // La photo est la destination
 
    // variable pour le texte de l image
    $rouge                     = imagecolorallocate($destination, 255, 0, 0);
    $blanc                     = imagecolorallocate($destination, 255, 255, 255);
    $grey                     = imagecolorallocate($destination, 128, 128, 128);
    $black                     = imagecolorallocate($destination, 0, 0, 0);
 
    $text_vue                = "Photo Vue $data_photo1[vue] fois";
    $text                    = "Axel - Photo Album";
    $ref                    = $id_photo."".$id_gal."_".$repertoire."_".$data_photo1['photo'];
    $extention                 = array(".JPG", ".jpg", ".jpeg", ".JPEG");
    $ref                     = str_replace($extention, "", $ref);
    $autorisation            = "Autorisation d'affichage accordé à $pseudo";
    $identification            = "N° d'autorisation : ".date("Ymd").".$ip.".date("siH") ;
 
    // Les fonctions imagesx et imagesy renvoient la largeur et la hauteur d'une image
    $largeur_source         = imagesx($source);
    $hauteur_source         = imagesy($source);
    $largeur_destination     = imagesx($destination);
    $hauteur_destination     = imagesy($destination);
 
    // On veut placer le logo en bas à droite, on calcule les coordonnées où on doit placer le logo sur la photo
    $destination_x             = $largeur_destination - $largeur_source;
    $destination_y             = $hauteur_destination - $hauteur_source;
 
    // On met le logo (source) dans l'image de destination (la photo)
    imagecopymerge($destination, $source, $destination_x, $destination_y, 0, 0, $largeur_source, $hauteur_source, 50);
    // On ecrit sur l image
    imagettftext($destination, 12, 0, 14, 15, $black, $font, $autorisation);
    imagettftext($destination, 12, 0, 16, 15, $black, $font, $autorisation);
    imagettftext($destination, 12, 0, 15, 14, $black, $font, $autorisation);
    imagettftext($destination, 12, 0, 15, 16, $black, $font, $autorisation);
    imagettftext($destination, 12, 0, 15, 15, $blanc, $font, $autorisation);
 
    imagettftext($destination, 12, 0, 15, 29, $black, $font, $ref);
    imagettftext($destination, 12, 0, 15, 31, $black, $font, $ref);
    imagettftext($destination, 12, 0, 14, 30, $black, $font, $ref);
    imagettftext($destination, 12, 0, 16, 30, $black, $font, $ref);
    imagettftext($destination, 12, 0, 15, 30, $blanc, $font, $ref);
 
    imagettftext($destination, 12, 0, 15, 44, $black, $font, $identification);
    imagettftext($destination, 12, 0, 15, 46, $black, $font, $identification);
    imagettftext($destination, 12, 0, 14, 45, $black, $font, $identification);
    imagettftext($destination, 12, 0, 16, 45, $black, $font, $identification);
    imagettftext($destination, 12, 0, 15, 45, $blanc, $font, $identification);
 
    imagettftext($destination, 12, 0, 15, 59, $blanc, $font, $text_vue);
    imagettftext($destination, 12, 0, 15, 61, $blanc, $font, $text_vue);
    imagettftext($destination, 12, 0, 14, 60, $blanc, $font, $text_vue);
    imagettftext($destination, 12, 0, 16, 60, $blanc, $font, $text_vue);
    imagettftext($destination, 12, 0, 15, 60, $rouge, $font, $text_vue);
 
    imagettftext($destination, 40, 0, 15, $hauteur_destination - 10, $blanc, $font, "N°".$id_photo);
    //imagestring($destination, 3, 15, $hauteur_destination - 20 ,$ref, $blanc); 
    //imagestring($destination, 3, 15, $hauteur_destination - 30 ,$text_vue, $blanc); 
 
    // On affiche l'image final
    imagejpeg($destination);
    imagedestroy($destination);
 
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
//ON INSCRIT LES LOGS DE L IMAGE -------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
    //on ajoute +1 a la photo visualiser
    $sql = "UPDATE galerie SET vue=vue+1 WHERE id='$id_photo' AND type='PHOTO' AND nom_album='$id_gal' ";  
    mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error());  
 
    $ip            = "[IP]".$_SERVER['REMOTE_ADDR']."[/IP]" ;
    $date        = "[DATE]".date("d-m-Y")."[/DATE]" ;
    $heure        = "[HEURE]".date("H:i:s")."[/HEURE]" ;
    $date_log    = $date." ".$heure." ".$ip."<BR />";
 
    //on verrifie si il a deja vue cette photo
    $sql = "SELECT date_log FROM galerie_log WHERE pseudo='$pseudo' AND id_photo='$id_photo'"; 
    $req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error()); 
    $res = mysql_num_rows($req);
    if($res != 0 ){
        //on modifie la BDD
        $data= mysql_fetch_assoc($req);
        $date_log    = $date." ".$heure." ".$ip."<BR />\n".$data['date_log'];
 
        $sql = "UPDATE galerie_log SET vue=vue+1, date_log='$date_log' WHERE pseudo='$pseudo' AND id_photo='$id_photo' ";  
        mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error());  
    }else{
        //on ajoute dans la BDD
        $sql ="INSERT INTO galerie_log VALUES('', '', '$id_photo', '$pseudo', '$date_log', '1')";
        mysql_query($sql) or die('Erreur SQL !'.$sql.'<br>'.mysql_error());  
    }
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
//--------------------------------------------------------------------------------------------------------------------------------------------------------------------
}else{
    header ("Content-type: image/png");
    $im = ImageCreate (800, 600) or die ("Erreur lors de la création de l'image");        
    $couleur_fond = ImageColorAllocate ($im, 255, 0, 0);
    // variable pour le texte de l image
    $blanc                     = imagecolorallocate($im, 255, 255, 255);
    $grey                     = imagecolorallocate($im, 128, 128, 128);
    $black                     = imagecolorallocate($im, 0, 0, 0);
 
    $font                     = './arial.ttf';
 
     imagettftext($im, 50, 0, 110, 100, $blanc, $font, "ACCES INTERDIT");
     imagettftext($im, 20, 0, 80, 150, $black, $font, "Les photos sont reservés aux membres enregistrés");
     imagettftext($im, 20, 0, 60, 180, $black, $font, "Pour vous connécter rendez-vous a l'adresse suivante :");
     imagettftext($im, 20, 0, 200, 250, $grey, $font, $url_site);
 
    //on cree l'image
    ImagePng ($im); 
    //on detruit l image de la memoir serveur
    imagedestroy($im);
}
?>
Iro87 est déconnecté   Envoyer un message privé Réponse avec citation 00
Vieux 09/09/2007, 19h29   #4
Invité de passage
 
Inscription : décembre 2006
Messages : 6
Détails du profil
Informations forums :
Inscription : décembre 2006
Messages : 6
Points : 2
Points : 2
C'est bon merci j'ai trouver l'erreur apres deux jour de recherche

enfaite dans ma page bdd.php
j'aivais mis des espaces a la fin du code sans faire expret et c'est ce qui devait posé souci
  1. <?php
  2. /*
  3. tout mon code ici
  4. avec les passwords etc etc
  5. */
  6. ?>

j'ai suprimer les saut de ligne apres la fermeture du ?> (ici ligne 7)
et depuit nikel
Iro87 est déconnecté   Envoyer un message privé Réponse avec citation 00
Réponse Proposer ce sujet en actualité Cette discussion est résolue.
Outils de la discussion



Fuseau horaire GMT +2. Il est actuellement 09h55.


 
 
 
 
Partenaires

Hébergement Web