Ôîðóì áîëüøå íå èñïîëüçóåòñÿ. Ïðèñîåäèíÿéòåñü ê êàíàëó #community-ru â Slack for TYPO3 community |
27.01.2007, 12:54 | #1 |
Íîâåíüêèé
Ðåãèñòðàöèÿ: 27.01.2007
Ñîîáùåíèé: 3
|
Âìåñòî êàðòèíêè âûîäèò ‰PNG
Ïðîáëåìà òàêàÿ: åñòü 2 ñòðàíèöû.
2.php: ////////////////////////////////////////// <?php header('Content-type: image/png'); $img = imageCreate(100, 100); $black = imageColorAllocate($img, 0, 0, 0); $white = imageColorAllocate($img, 255, 255, 255); $orange = imageColorAllocate($img, 255, 128, 64); $lightorange = imageColorAllocate($img, 255, 220, 164); imageFilledRectangle($img, 0, 0, 100, 100, $white); imageRectangle($img, 0, 0, 99, 99, $black); imageRectangle($img, 5, 5, 94, 94, $black); $points = Array(12,10, 20,15, 15,20); $nump = (int) count($points)/2; imagePolygon($img, $points, $nump, $orange); imageLine($img, 17, 18, 27, 33, $orange); imageLine($img, 18, 18, 28, 33, $lightorange); imageLine($img, 19, 18, 29, 33, $orange); imageRectangle($img, 15, 33, 80, 75, $orange); imageFill($img, 14, 14, $lightorange); imageFill($img, 20, 40, $lightorange); imageString ($img, 2, 20, 40, "I'm a PHP", $black); imageString ($img, 2, 30, 55, "image", $black); imagePNG($img); ?> ////////////////////////////////////////// add.html: ////////////////////////////////////////// <img src="2.php"> ////////////////////////////////////////// Ïîä Denwer âñå ðàáîòàåò: ìîæíî ãðóçèòü è 2.php, è add.html. Íî êîãäà ÿ äîáàâëÿþ ýòîò êîä íà ñòðàíèöû ãîòîâîãî ñàéòà(îí - íà typo3), òî php-ôàéë ïîêàçûâàåò âìåñòî êàðòèíêè: ‰PNG IHDRdd Œ}Ç PLTEÿÿÿÿˆ@ÿܤDCígIDATxœíÖ;  ... Áèáëèîòåêà GD ïîäêëþ÷åíà (ñóäÿ ïî íàñòðîéêàì - ñì.phpinfo()). Íèêàêèõ îøèáîê íå âûâîäèò,ïðîñòî âìåñòî êàðòèíêè âûâîäèòñÿ ýòîò ñòðàííûé òåêñò.Êàê ÿ ïîíèìàþ, ýòî ïðîèñõîäò èç-çà âûâîäà êàêîé-òî èíôîðìàöèè äî header â ñêðèïòå. Î typo3 ÿ çíàþ Î×ÅÍÜ ìàëî, à ðàçáèðàòüñÿ íåêîãäà - íàäî ýòîò ñêðèïò ÑÐÎ×ÍÎ ïðèêðóòèòü ê ãîòîâîìó ñàéòó. ÎÃÐÎÌÍÀß ïðîñüáà ïîìî÷ü!!!! |
27.01.2007, 19:03 | #3 |
Íîâåíüêèé
Ðåãèñòðàöèÿ: 27.01.2007
Ñîîáùåíèé: 3
|
Íà ñàéòå åñòü 2 ñòðàíèöû.
Çàãðóçêà ïðîèñõîäèò ñî ñòðàíèöû ¹1. Òàì åñòü HTML êîíòåíò, â êîòîðîì åñòü òîëüêî îäíà ñòðîêà: <img src="2.php"> Ñòðàíèöà ¹2: íàçûâàåòñÿ "2.php" è ñîäåðæèò PHP êîíòåíò, â êîòîðîì íàõîäèòñÿ ñëåäóþùèé êîä: <?php header('Content-type: image/png'); function RandCharImage($code) { $font = "font.ttf"; $img = ImageCreate (320, 50); $color = array(); $color[] = ImageColorAllocate ($img, 0, 0, 0); $color[] = ImageColorAllocate ($img, 0, 0, 127); $color[] = ImageColorAllocate ($img, 127, 0, 0); $color[] = ImageColorAllocate ($img, 0, 127, 0); $color[] = ImageColorAllocate ($img, 127, 127, 0); $color[] = ImageColorAllocate ($img, 127, 0, 127); $color[] = ImageColorAllocate ($img, 0, 127, 127); $color[] = ImageColorAllocate ($img, 127, 127, 127); $color[] = ImageColorAllocate ($img, 0, 0, 255); $color[] = ImageColorAllocate ($img, 255, 0, 0); $color[] = ImageColorAllocate ($img, 0, 255, 0); $color[] = ImageColorAllocate ($img, 255, 255, 0); $color[] = ImageColorAllocate ($img, 255, 0, 255); $color[] = ImageColorAllocate ($img, 0, 255, 255); $color[] = ImageColorAllocate ($img, 255, 255, 255); $sx = ImageSX ($img) - 1; $sy = ImageSY ($img) - 1; $sc = count ($color) - 1; // Background noise: for ($i = 0; $i < 1024; $i++) { $x = mt_rand (0, $sx); $y = mt_rand (0, $sy); $c = $color[mt_rand(1,$sc)]; ImageSetPixel ($img, $x, $y, $c); } // Output of a code: $xpos = mt_rand (4, 16); $height = $sy - mt_rand (0, $sy / 4); for ($i = 0; $i < strlen($code); $i++) { $angle = mt_rand (0, 45) - 22; $size = mt_rand (0, 10) + 30; $ypos = $sy - mt_rand (4, $sy - $height); $c = $color[mt_rand(9,$sc)]; $rect = ImageTTFtext ($img, $size, $angle, $xpos, $ypos, $c, $font, $code[$i]); $width = $rect[2] - $rect[0]; $height = $rect[1] - $rect[7]; $xpos += $width + mt_rand (0, 32) - 8; } //Forward noise: for ($i = 0; $i < 256; $i++) { $x = mt_rand (0, $sx); $y = mt_rand (0, $sy); $c = $color[mt_rand(1,$sc)]; ImageSetPixel ($img, $x, $y, $c); } for ($i = 0; $i < mt_rand (2, 8); $i++) { $x1 = mt_rand (0, $sx); $y1 = mt_rand (0, $sy); $x2 = mt_rand (0, $sx); $y2 = mt_rand (0, $sy); $c = $color[mt_rand(0,$sc)]; ImageLine ($img, $x1, $y1, $x2, $y2, $c); } ImagePng ($img); ImageDestroy ($img); } session_start(); RandCharImage($_SESSION['code_chars']); ?> Åñëè ãðóçèòñÿ ñî ñòðàíèöû ¹1-òî êàðòèíêà íå âûâîäèòñÿ, åñëè ñî ñòðàíèöû ¹2 - âûâîäèòñÿ ñëåäóþùåå: ‰PNG IHDR@2ÓòæÕPLTEÿÿÿÿÿÿÿÿÿÿÿÿ?_ß¿Ÿ ___ŸŸŸ???ßßß¿¿¿??ÿßß??ŸÏÏŸÿÿŸŸ?ßÿÿ?ÿÿ¿ÿŸ_?¿¿? ¯ÿßÏ/??Ÿ__ÿ??ÿŸÿŸÿ?ŸŸÿ_¯¯¿¿¿ßÿ_ÿßÏ¿?¿??Ÿ_ÿ¿ßß ŸŸ__??¿¿ßï¿ÿŸŸ_FêŒE ‰IDATxœ[‡²ë¸ ¥ä¢jY²%[v’MvÓ&uR&“êÛ6ÉÿR°,²îËÃ쾫B‘ÀÁR²íF(1E)¬d""?ü oNZÑîÃÛRr<(ÕaL¢} QWºxCqH\žÝõ{,–׽ǶɆ‹²å§>DFÛÝB)\˜©ä‡t %ð÷¥µÕÕxÚG®‹«éf©JœDNöOîó–¹õZt¼èÏ?žOų-¦è.tÆ.BðÆê ÓW9µ,ÅZI[¼k–ˆ’Û±âRGÜjŒ*üˆ‹bH|ŒRý¿¥ÑÒdÏ7> è ò.ä. |
27.01.2007, 21:23 | #4 |
Senior Member
|
2.php - ýòî ñòðàíèöà â TYPO èëè ïðîñòî ôàéë ëåæàùèé íà ñàéòå?
|
27.01.2007, 21:46 | #5 |
Íîâåíüêèé
Ðåãèñòðàöèÿ: 27.01.2007
Ñîîáùåíèé: 3
|
ÁÎËÜØÎÅ ñïàñèáî âñåì çà ïîìîùü, íî îøèáêà óæå íàéäåíà.
Ðåøåíèå áûëî â òîì,÷òîáû ïåðåíåòñè ôàéë 2.php â äðóãóþ ïàïêó - òàê è íå ñòàëî ïîíÿòíî, ïî÷åìó ññûëêà íà ôàéë 2.php â ñòàðîé ïàïêå íå ðàáîòàëà-ïóòü áûë ïðàâèëüíûé. Ïîñëå ýòîãî êàðòèíêà ñòàëà íîðìàëüíî ïîêàçûâàòüñÿ. |
|
|
Ïîõîæèå òåìû | ||||
Òåìà | Àâòîð | Ðàçäåë | Îòâåòîâ | Ïîñëåäíåå ñîîáùåíèå |
tt_news ñ ïðîèçâîëüíûì ðàñïîëîæåíèåì êàðòèíêè | Âëàäèìèð Óìíîâ | Îáùèå âîïðîñû | 1 | 09.10.2005 16:55 |
Êàðòèíêè è /uploads/pics/... êàê ïîáîðîòü? | S40 | Îáùèå âîïðîñû | 3 | 29.10.2004 23:26 |