Librairie GD
Posté : 11 déc. 2016, 23:04
Bonjour à tous,
je n'arrive pas à afficher mon image GIF via la galerie GD, extension activée sur wamp.
Voici mes erreurs :
je n'arrive pas à afficher mon image GIF via la galerie GD, extension activée sur wamp.
Voici mes erreurs :
( ! ) Notice: Use of undefined constant ERR00 - assumed 'ERR00' in C:\wamp\www\2016\SITE\html\image.php on line 253
Call Stack
# Time Memory Function Location
1 0.0010 168584 {main}( ) ..\image.php:0
( ! ) Notice: Use of undefined constant ERR01 - assumed 'ERR01' in C:\wamp\www\2016\SITE\html\image.php on line 253
Call Stack
# Time Memory Function Location
1 0.0010 168584 {main}( ) ..\image.php:0
( ! ) Notice: Use of undefined constant ERR02 - assumed 'ERR02' in C:\wamp\www\2016\SITE\html\image.php on line 253
Call Stack
# Time Memory Function Location
1 0.0010 168584 {main}( ) ..\image.php:0
( ! ) Notice: Use of undefined constant ERR03 - assumed 'ERR03' in C:\wamp\www\2016\SITE\html\image.php on line 253
Call Stack
# Time Memory Function Location
1 0.0010 168584 {main}( ) ..\image.php:0
( ! ) Warning: Cannot modify header information - headers already sent by (output started at C:\wamp\www\2016\SITE\html\image.php:253) in C:\wamp\www\2016\SITE\html\image.php on line 254
Call Stack
# Time Memory Function Location
1 0.0010 168584 {main}( ) ..\image.php:0
2 0.2459 1267944 header ( ) ..\image.php:254
GIF89aXXç#ƒÛì› B‰NÄüDBD_„¥c°šÌÛÿÿÿ9¤÷E˜ôÍ‘ "<cÇ@…Ê™çô)n`äü}¤¾ÿÿÿÿÿÿ'Ed„ƒ„ T±dcd|ÄÕÿÿÿa³ñ$"$”•”¶éúvÔüÿÿÿœ¯½0“îÌñüÿÿÿÿÿÿÿÿÿÿÿÿ4]sÓÃÌÔA”Þ3cˆC¶û8w*xɘüó˜Ýùÿÿÿ†ÊÚr´ÜÿÿÿÿÿÿO”ØÿÿÿXtÿÿÿb“´T‹ÿÿÿÿÿÿÿÿÿdÂöêÖÿÿÿCjÿÿÿ1t²ƒ’¤ÿÿÿdtŒÿÿÿÿÿÿ†äóÿÿÿÿÿÿÿÿÿ¸ýúÿÿÿÿÿÿˆÓð.…äl¦ÝP¬ó©èúÿÿÿLWaÿÿÿE¯ÌÍÏ–¢ªÿÿÿÍsGÝÇwÖ5~,¹òäu–/E^§YçÏ C‹†ù’;—4Ÿ¾„Y3æuê^Ç®»¶gØ¢sç~ìr©Þ¤— NÜwñãÈI;þíØóäß{C'>œzòà¥$³NÍÙ4¥Ôß…þ|ÿ~iüJã)G_ž<ûR”Ä«7¯^ˆfõ‘QSV½ù5çuB` €ÿèßþÍ&Û Ö†`¯ à„œÙg¡iÚG ¬q(¡if¢ˆŽh „ÿQèaþQÈšŠ"`ƒÊè ‚4Þ˜ 9bÖ£™áŠ d‹6FH A&YoÍ!—]vú§Û•Q–"„–¨]ÂejZ'™•Ê56šsÍ¥©›™“•ioQGtŸµ)çuÅfgwb—&qub'œo[Úßy^ÆWž–ßÁg|â-%‡RJi{’. æ–ø wš§Ôq™kÛµfê©nvGcFÙª›þùÝÁe~ÛiVkw© ¡ë®º¦æë¯ÀúŠ«¯¼öšk°q×á²¥+lÍ*‹ª©¬¡†™µÑ]¬væçj·—Mö-”¼‰šÙ˜ÿ•,²Ë&;í%±Á+¯~öuÙe“°ÁЧ~ÕÁi&––Öe)¶zù˜fÛ:·-›j¢É'Àâò&±rqF¬°Ä¢¹ïœëÙ1™€’»°È‚Ú«e¦–¢—2§“ÂWÊ8è1êhÌ—–"È¢œŠÚpZªÓï ÂY¥“”å‡.oð ]œÒm‡°¬g竵Ä[¬ˆëfmš…½vmlÖÎj-¶ØÎ{ôÁÙLåÆ7MrÓ€âY«µ]bMö¯¦]þ°ú¥ÖwjÉ \”pû¶ÎÏ{|g˜”ªÁG®Æÿû/–‹eÆq n±åã 1å_L¸çàÎYš—‘:šh|3ÏÜò+-ÃŽ§Â{Î{i+v‡~ø–¤uæÚ&ð«mýøÁjûí»v¹ZÍ«ÝcKb†öa˜ý÷à³û_ièj§¬’U‡xžÞ¼¾É>~ÝÇní½Ö§vI=gê({°ï—D“Jç>÷ÍJ£ÃŽ¡tŸá ìSÓéVçÖ1ÅcW–¹ÌOWbS?÷¹Š‰ðMÑó]ãtÝAÊR^§$e;JCVãØT£V3«ÈÍê€þ’óc’w1ZÅdlŽf§-uïWº’¡Õ¼÷Äðm¯kV´b÷ªˆ?Ëp«ZmzZ~¨Ô§äô©ŒíS ýÖ·îl{ëJÿöæ¿‚ýŠ~Su 6»öÀ¿³Vÿ„Íš~Åþ«Je*Öu¿NÈ+‹µªÝ"¦7MöN{šÓyl›Sõ›ø©S\NhE•ú8¹ÝŒ:ìîÐQž¿œê×|´½78þä¨oÞ«ë¹ôp5¬à²îP:L34¤eLXäzêÆzL7T1bÅs>pV{<Ôxªce$§{tJô?vE—vZbpÇw|L’¨|’ñ EHôuI×÷AGQcRbþb}ÏxÚçG7eæ…Pº6kåWã‡W´æIÞ$*A“>˜5yw y ðã•&v2ëp€Õzb‡š6p•s!úbµ°«Ê_"Jƒ$±¨”[«\þ ¦RÆ”½Je…½Ž”¤%×JÅZ&kŠTI–î%uš"l%†Ë†xŒòRÝ„yÃt2\S†.»`Ÿ9’•plø‘+Ê">³Qs¹DG´’!ŠoæäªºáÐÝC¹év ª+´q$gaE»¼ y°",(#Š0¾ËSøˆ šiW›iÆë]ßY§H)z5½ÅóÁÓV=&½7xW$÷ަ«Z9¡ ¦Eè½õˆho"S#wfÄ^²»µ†Ä¸ê‹“)[g-4§~ÛJA©Bž067‘¨3M8Fåƒz² l4“±YGd¹ùrDαÀÀqp-?+Áþ˜!ºÀ‰ŒÒ9, qMt[þss=Z½šj'&™¨á»¬¥§Üƒiç9“5y&…Ó_ó1LˆT°„b‘dÆN›óµY¾,o5±N‘D„'´½¬¬@ÝÚ_†Ã1N{›‘ø;$5Z†(Œó»Ó;ËxÙ*=;‡¯ÉYG©¨hz˜’k.áÇó$¸T1’‘ùáÍù‘Ç’qŠ—Ði ¯PCqœ¡º‚œà+¢› ‘ÇB°Á©A“õÌ÷¼Ð?¡‹ÀpÛÁÀ” Ò€ ˜ÐðmÂp<£€ ¸[þ ‹`Ò Äð²PÐ-²á`ဉva‚‹)pþÊ]î³ÙVf«6ARÙ“feѨ•[ú¤¹J¥S–^¢XkáW8v›l¥S\2`›Åº ‰ä&ÊV(hç¹zäÖ7'9K•›4±YÞ‚R«R4›.ê ¹Cѹç, æ,P÷p ÄÐ=}È\‚°ÁÁy ©1ÓÐψL,–- õ|ÒÀЗ°—°ÐÝsp²€ ¯àà•!]Ûëp˜À ¥ÒŠ@wŠ€»äœwp²MÛ¥ ’AÚÑP þpÒ+p iÐÃA ¾Ë‰ Ñ \ †É?M¼œ<ÔzbIêSÜ›Uª¤È–p¯ªÊž|¥—X «Ö§”»Æ½_ZwLë¶ë£t˜D‚%iÑ“› ¤–®c‘Øsêš«ºx 5¿æ’¨§Š‘ç&+¥×Es-Àm¤c`O¢×Íz<*çœÓÖmÁ¾ÂÒ òŒÈ—ºô»¹RPÙ”ý+ÝÏà˜ší+½ÚiãÒÀÐõì•xüÛŸ Ò@ ðÛê ÒpÕAÒ ]p»ÛY΂1-ÝyÐØ¥pK®–ÜKnaN¼¢J¤19ÃDÝRž¥ßþAÚêW5Ê«Jåþ8&Ïàg–þ?Ÿ§¼Cö?‚ Mãtbd[D”v Íñ$v¼RƒÍÀ²à©qݲ2NãC¾Á\ðã9þ+<îÙ\ÔôWnäOtÑBpÑyºïÄŠ »wpåÀÝÄV®A¶gW^ Ö~-2%º/Åæ\ %Ûíy€Z‰kLáð7ðý <ÇA)£Üv‡Ä_Ð#ŸÇOƒ¾WñçÃ–Ê ËAXe±bJV{÷P8Fó])X“a¢×–/³‹‹{Æß´ˆZêsê?0©>Tò2.ÌÑ-$>µŽâ”SÇxlθѾΊýãÙžÁŸþMº¢í+iÙöÁÙB>È©ÒÙEž3.|/È.ނמŠ@f: ð|Ï eOÒ²ÒÝ÷ÀÑyP i wpŠpPÚ±îÎ#EJ](PJ \.]’öhÝ:E¸. Œ—„xÄRÐ%Ž9žrRZu-]¾Tw'¦Ì;5mÚ,UóR)!9kÂÚ’æŸ>*¼DTàÍš¥\þ¤TêT 2…ÎdšUkÌ™\£röëU«C½zý jס?Ï®U«UáÍœlé2õÙ–é·<ý ¹Cé%ž„?úLZêáNÀŒû®ã{‡/OÉ‘k%štçÆþ}iâÄ;ëȺ…‹¶¬Ð«Õ lÝòÒ벦ŸÎ&6CÓ_wð°˜KiÅ/|D(¡ð_È# @ž‰.]Pú—柡KWmäõèÒ Cž<DÍP“ô<²rê—7CqÝYAi0!¦&b
et mon codage :
<?php
require('gif.class.php');
$animation = array();
$duree = array();
//define('LARGEUR', 600);
//define('HAUTEUR', 600);
/* * ******************************* * Parametre * ******************************** */
$largeur = 600; /* longueur de l'image */
$hauteur = 600; /* hauteur de l'image */
$txt = str_replace ("vœux", "voeux", $_GET['fichier']);
$txt = rawurlencode($txt);
$txt = str_replace('%92', '%27', $txt);
$txt = rawurldecode($txt);
/* * ******************************* * IMAGE 1 * ******************************** */
$image = imagecreate($largeur, $hauteur);
/* Background */
$background = imagecolorallocate($image, 0, 255, 0);
$image= imagecreatefrompng('carte_voeux_2016/1.png'); //Notre joli fond :p
/* Couleur du text */
if($_GET['couleur'] =='orange') {
$couleurTxt = imagecolorallocate($image, 238, 153, 26);
} else {
$couleurTxt = imagecolorallocate($image, 19, 57, 92);
}
/* texte à mettre dans l'image */
/* Taille du texte */
$font_size = 9;
putenv('GDFONTPATH=' . realpath('.'));
$font = 'arial.ttf';
/* Hauteur et largeur des caratères */
$largeurCaractere = ImageFontWidth($font_size);
$hauteurCaractere = ImageFontHeight($font_size);
/* Longueur du texte (taille caratère X nombre de caractère) */
$largeurTxt = $largeurCaractere * strlen($txt);
/* Recherche de la position horizontale centrale pour centrer le texte */
$positionCentreHor = ceil(($largeur - $largeurTxt) / 2);
/* Recherche de la position horizontale centrale pour centrer le texte */
//$positionCentreVer = ceil(($hauteur - $hauteurCaractere) / 2);
$positionCentreVer = 380;
/* Ajout du texte au centre de l'image */
$angle = 0;
$text_length = 80;
$new_text = wordwrap($txt, $text_length, "<br />", true);
$text = str_replace('<br />', "\n", $new_text);
// $fontsize = 12;
// Get image Width and Height
$image_width = imagesx($image);
$image_height = imagesy($image);
// Get Bounding Box Size
$text_box = imagettfbbox($font_size,$angle,$font,$text);
// Get your Text Width and Height
$text_width = $text_box[2]-$text_box[0];
$text_height = $text_box[7]-$text_box[1];
// Calculate coordinates of the text
$x = ($image_width/2) - ($text_width/2);
$y = ($image_height/2) - ($text_height/2);
// Add some shadow to the text
imagettftext($image, $font_size, 0, $x, 410, $couleurTxt, $font, $text);
ob_start();
imagegif($image);
$animation[] = ob_get_clean();
$duree[] = 50;
imagedestroy($image);
/* * ******************************* * IMAGE 2 * ******************************** */
$image = imagecreate($largeur, $hauteur);
/* Background */
$background = imagecolorallocate($image, 0, 255, 0);
$image= imagecreatefrompng('carte_voeux_2016/2.png'); //Notre joli fond :p
/* Couleur du text */
if($_GET['couleur'] =='orange') {
$couleurTxt = imagecolorallocate($image, 238, 153, 26);
} else {
$couleurTxt = imagecolorallocate($image, 19, 57, 92);
}
/* texte à mettre dans l'image */
/* Taille du texte */
$font_size = 9;
putenv('GDFONTPATH=' . realpath('.'));
$font = 'arial.ttf';
/* Hauteur et largeur des caratères */
$largeurCaractere = ImageFontWidth($font_size);
$hauteurCaractere = ImageFontHeight($font_size);
/* Longueur du texte (taille caratère X nombre de caractère) */
$largeurTxt = $largeurCaractere * strlen($txt);
/* Recherche de la position horizontale centrale pour centrer le texte */
$positionCentreHor = ceil(($largeur - $largeurTxt) / 2);
/* Recherche de la position horizontale centrale pour centrer le texte */
//$positionCentreVer = ceil(($hauteur - $hauteurCaractere) / 2);
$positionCentreVer = 380;
/* Ajout du texte au centre de l'image */
$angle = 0;
$text_length = 80;
$new_text = wordwrap($txt, $text_length, "<br />", true);
$text = str_replace('<br />', "\n", $new_text);
// $fontsize = 12;
// Get image Width and Height
$image_width = imagesx($image);
$image_height = imagesy($image);
// Get Bounding Box Size
$text_box = imagettfbbox($font_size,$angle,$font,$text);
// Get your Text Width and Height
$text_width = $text_box[2]-$text_box[0];
$text_height = $text_box[7]-$text_box[1];
// Calculate coordinates of the text
$x = ($image_width/2) - ($text_width/2);
$y = ($image_height/2) - ($text_height/2);
// Add some shadow to the text
imagettftext($image, $font_size, 0, $x, 410, $couleurTxt, $font, $text);
ob_start();
imagegif($image);
$animation[] = ob_get_clean();
$duree[] = 30;
imagedestroy($image);
/* * ******************************* * CREATION IMAGE * ******************************** */
$gif = new GIFEncoder($animation, $duree, 0, 2, 0, 0, 0, 'bin');
header ("Content-type: image/gif");
echo $gif->GetAnimation();
?>
Merci pour votre aide.