captcha работает хорошо в моем localhost usbwebserwer. В веб-serwer captcha изображение не отображается. когда открытое изображение в firefox см. код:
ÿØÿà JFIFÿþ>CREATOR: gd-jpeg v1.0 (using IJG JPEG v62), default quality ÿÛC $.' ",#(7),01444'9=82<.342ÿÛC 2!!22222222222222222222222222222222222222222222222222ÿÀ(x"ÿÄ ÿĵ }!1A Qa"q2'¡#B±ÁRÑð$3br‚ %&'()*456789:CDEFGHIJSTUVWXYZcdefghijstuvwxyzƒ„…†‡ˆ‰Š'“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚáâãäåæçèéêñòóôõö÷øùúÿÄ ÿĵw!1AQaq "2B'¡±Á #3RðbrÑ $4á%ñ&'()*56789:CDEFGHIJSTUVWXYZcdefghijstuvwxyz‚ƒ„…†‡ˆ‰Š'“”•–—˜™š¢£¤¥¦§¨©ª²³´µ¶·¸¹ºÂÃÄÅÆÇÈÉÊÒÓÔÕÖ×ØÙÚâãäåæçèéêòóôõö÷øùúÿÚ ?õ {¥Ãgieg§ìmNÞ8a¶É,aË'\)ù NðK|Äv'Y“X˪¨ÚÜÛB-£•bx¥hB³ 1æo¼r褟˜ °©5Ý&ÊËJ¶Õ, Ħ‚â@åZ G1rýÅR9þš²'K› h,®ôíÿe„ùÊЋ€Ê@Ü@VÄ[É*ÊÌJ3}ìŽè$õ‹þ¿«·Ü»iâ´i¦öm>í§G–cöh2 °“º Êã+Ø6rß=mÙjÚÌsMoy áÃ[2q9$ ÈÇ;T« ¤6îBõÀ–íõ ¤– Ár]ÝÅŵ¯rñ'ª r2@áñÔ»tÒEoy¨Ío-¾£Ôb`æI¼éV6 ¨œ,ƒ¹¹@ ¤ï;Y‰Ev³ûÄ™· M¨¾¡x.nÙ'ÙÑ>Ð]b(~@#• q'¤3§Êq¸Ö$šd–1ßé–÷×+o :ÚÞ¢LŒxm¹Sµ6»+1'0, Œ·x}üS«Ú]\Zx²k1l‹Iµ '¤Y‚ \ð0@ÎX õé“ÇumðÒyn¼Eo¨kš\ Žã‰s2±.̸+´àrªày§k…îo¾±¨é–ñÞI»)+^.õ Œ‡Úƒ pÃm?6NßšµÛ¤‚IþÉ"”DIH…Ö±„aÃdnbNÔ<¥¸ç~ \6¡áë«ínöîP—rEï{(³*9¾X±Ë $ãïgåÜ›M¹²»Õ--îÚÈFmä†ÞRüË' 4{¨ ÇÏÆìàäÏ,Sqc»µËúŽ¥¡ CmG%º`É°¬Ä«$jåU3*î< © @ÒŠhçŒÇeªÃ1Œ$ûñîL[s¿ ˜yJŒ3ç ÀSæ6¾#·ŸÇm*£œÊ%žûS±- +¿$« K 7‚GžÍtó©ÜØËka¤ÄâÜËöu%Šg#Ê @'Ž¹â‰ÓJÉ°R¹½} z|w–6ØGiÓÉå¶ÐÊÛ‰\î8òÉwࣜTEå•õ¹â–9áO–A0Œ ÆIhKd¬„Œœ 8,\Œ¡h:-Œ'_Ì€ÆU/†ô*w`˜Â»pf ±n 2ƒE†“syT;eÈ'ŒäžTœ'<Ö‰/õtoÊXeÒî´É'b‡toóR1¸‰$ÈCŸâÚÙ´5KúìKÜóøNóÅþ ¼ zÑ VqPÆ¥¤c´þôƒ¼¯ ýÆÀ'öZ„5mË£~÷ê#co=¡Rˆ¬¤*ùóù$ƒµ6'wgå5¾ ^\¯…,¡B^MBYSæزmXò¥„ŠxÎHÚã;N®³Tׯ/í5Ý;O™|¼D%V 䃂ü—8U_˜åˆSZÊsç²Ø„• Ó´¯XØj¶Öò^é±Z@×WVí#ÂdNÊÿÕÒé3Oâ k½ìw×·©o4~h'JÄK4ŒêGÝ#ävùMsÚÖ²ð ëN&ôn n,UŽB…ÉrH+×vyÎk²ÑYð×ÂÝ_L¸Ògß-Ïï@ÚѸ *r¯=1‡çŽ7í¦ä#'м=©êÞ Ôï-.Œ Z4"¥Ä걇pÎÁ€ªBž¤Ÿök¦ð=æ£ÿ«j—eo-l¦6–ñ^š.B' 3†\Ú NÀg‚ ¹O…ZõìqÀЫÝFï4 ÁµÁØ œ,ƒ åˆQ€2iŸ ÙŸÃr[‰´˜Þ;.‰ p±Œå72°”$ð &Û¸ÒØåãðdòxí|+öØcˆQ<Ѽk“ð6° 3ÐqÉ"½{ı\^økQÔ$±»‹PŽÎxå“dO´K0 å3† oâód„Ïû¶iI“ }ðF~SÂóŒƒCÂöžx‚êKe–ݨup) ®ÓÀ'-× }w[ ¢„h×rMm,ÂIÌAи?îÊnÙ¸àž‚Ê¸ÏÍŠ¬ÄŠ^ñ—ö^™áû=×('ÝÌ—& É Tpç3IÏnri|&Žy!Öu'6Èxƒ]Ïr}òÇÏ"í9aƒ†Î?ÁÙè]éÚíÔbVM0)BFYñÎ Ëò«ž>\u"½Ÿáfœ–¾³êV³^Mæ#yJgV22( ÌAÜ« oñ¸ çYÆ1vëÿ TnÙ¿¦ÝÜéÚEí¸¶½ ÙG,¶Í$&$eRÌ»þD?À¹'ÞiÏ}¥^·ŠÞÒú{[};θTŽ|Ef±ÄŠTª†`œyy`‹EróÅ6ÜoøY÷ lÓ5t·?<vÕ2óæ@ù.!‚u¶9?u…[¤Ó^ßLÔ'HaÓ¢2¥±ù4„ã˜ÊìháŽå EEmëù e SÃÜÛI$:|¨îež8¬žXbF }æÄjHf%šNêMk‰î´ø>Ñ¥Ù[K¦ÊBºvÖÛ"ªà«ó`Pü¤½¸tRŠNMÙ=F—bÝÕ¬ïxñ4ùµdKHªù€ºC™U¼Ì…\ó‚pYys.£=šÄÚD ÊR1=Éš}¹MÅBòpÛ~bëÈV%h¢³RÕ ÆDž¿¶'-…ýíéÄ“òª‚ëóo@_rÎñ'¬ AWªó˦è÷sD4…þÓR‰¹›#LJB';t W9e'6ÇiEoJn£´» $–ÆÌwu©Ã;¼6qÞFÉ-µÄLî¨H 9)ó#iÛ÷Ü ±&´f[ä™ná2I+¥Ï”#qI‡F yóÕÁ!ˆ¢³Ý¤2–™!Ô,£xå[Avñ}¤ ˜ MªûAåz¨íÚ~`]¨X]É«!¼¹Ó>Á4ÌP«¾Ì!mÇsI'Tê:QE&í+!¥tC§ÙZ궖ªÑ[#‹P¢Ý ŠUŽDØ 'Ì|°0~æ A*jº´1³Ùÿiëˆäâ,†)nr<àåßÆÒ¤ÿt•V%¢Õ²KE{a|ÓÃr×PÜÀ²3B²yyEù OšXº®ÒAÕ™2QEJŠ–ã»[ÿÙ
Вызов Chrome: ресурс интерпретируется как изображение, но передается с типом MIME text / html
Вот код в моем captcha:
<?php /** * @version 1.6.0 * @package Joomla * @subpackage OS Membership * @author Tuan Pham Ngoc * @copyright Copyright (C) 2012 - 2013 Ossolution Team * @license GNU/GPL, see LICENSE.php */ // Check to ensure this file is included in Joomla! defined('_JEXEC') or die(); class CaptchaSecurityImages { function generateCode($characters) { /* list all possible characters, similar looking characters and vowels have been removed */ $possible = '23456789bcdfghjkmnpqrstvwxyz'; $code = ''; $i = 0; while ($i < $characters) { $code .= substr($possible, mt_rand(0, strlen($possible) - 1), 1); $i++; } return $code; } function CaptchaSecurityImages($width = '120', $height = '40', $characters = '6') { $session = JFactory::getSession(); $this->font = JPATH_COMPONENT . '/assets/font/monofont.ttf'; $code = $this->generateCode($characters); /* font size will be 75% of the image height */ $font_size = $height * 0.75; $image = imagecreate($width, $height) or die('Cannot initialize new GD image stream'); /* set the colours */ $background_color = imagecolorallocate($image, 255, 255, 255); $text_color = imagecolorallocate($image, 20, 40, 100); $noise_color = imagecolorallocate($image, 100, 120, 180); /* generate random dots in background */ for ($i = 0; $i < ($width * $height) / 3; $i++) { imagefilledellipse($image, mt_rand(0, $width), mt_rand(0, $height), 1, 1, $noise_color); } /* generate random lines in background */ for ($i = 0; $i < ($width * $height) / 150; $i++) { imageline($image, mt_rand(0, $width), mt_rand(0, $height), mt_rand(0, $width), mt_rand(0, $height), $noise_color); } /* create textbox and add text */ $textbox = imagettfbbox($font_size, 0, $this->font, $code) or die('Error in imagettfbbox function'); $x = ($width - $textbox[4]) / 2; $y = ($height - $textbox[5]) / 2; imagettftext($image, $font_size, 0, $x, $y, $text_color, $this->font, $code) or die('Error in imagettftext function'); /* output captcha image to browser */ header('Content-Type: image/jpeg'); imagejpeg($image); imagedestroy($image); $session->set('osm_security_code', $code); } }
здесь HTML:
<div style="position:relative"> <input type="text" class="inputbox input-mini" value="" size="8" name="security_code"> <img src="/rejestracja-enterprise-kwartalnie?task=show_captcha_image" title="Please enter the code you see in the image into Security code textbox" align="middle" id="captcha_image"> <a class="osm_reload" href="javascript:reloadCaptcha();"></a> </div>