Russian TYPO3 community Ôîðóì áîëüøå íå èñïîëüçóåòñÿ. Ïðèñîåäèíÿéòåñü ê êàíàëó #community-ru â Slack for TYPO3 community  

Âåðíóòüñÿ   Russian TYPO3 community > Îáñóæäåíèå îáùèõ òåõíè÷åñêèõ âîïðîñîâ > Îáùèå âîïðîñû

Îòâåò
 
Îïöèè òåìû Îïöèè ïðîñìîòðà
Ñòàðûé 27.01.2007, 12:54   #1
Nat
Íîâåíüêèé
 
Ðåãèñòðàöèÿ: 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 ÿ çíàþ Î×ÅÍÜ ìàëî, à ðàçáèðàòüñÿ íåêîãäà - íàäî ýòîò ñêðèïò ÑÐÎ×ÍÎ ïðèêðóòèòü ê ãîòîâîìó ñàéòó. ÎÃÐÎÌÍÀß ïðîñüáà ïîìî÷ü!!!!
Nat âíå ôîðóìà   Îòâåòèòü ñ öèòèðîâàíèåì
Ñòàðûé 27.01.2007, 15:02   #2
void
Senior Member
 
Àâàòàð äëÿ void
 
Ðåãèñòðàöèÿ: 14.03.2006
Àäðåñ: Russia, Penza
Ñîîáùåíèé: 1,504
Îòïðàâèòü ñîîáùåíèå äëÿ void ñ ïîìîùüþ ICQ
Ïî óìîë÷àíèþ

À êàêèì îáðàçîì âû äîáàâëÿåòå êîä è êàêîé èìåííî "ýòîò"?
Åñëè âñòàâèòü â êîíòåíò êîä <img src="">, òî âñ¸ äîëæíî ðàáîòàòü.
Åñëè æå âû ïûòàåòåñü ïðÿìî â ñòðàíèöó âñòàâèòü php-êîä, òî ëîãè÷íî, ÷òî ó âàñ íè÷åãî íå ïîëó÷àåòñÿ.
__________________
TYPO3 FAQ
void âíå ôîðóìà   Îòâåòèòü ñ öèòèðîâàíèåì
Ñòàðûé 27.01.2007, 19:03   #3
Nat
Íîâåíüêèé
 
Ðåãèñòðàöèÿ: 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> è ò.ä.
Nat âíå ôîðóìà   Îòâåòèòü ñ öèòèðîâàíèåì
Ñòàðûé 27.01.2007, 21:23   #4
PhilD
Senior Member
 
Ðåãèñòðàöèÿ: 10.03.2006
Àäðåñ: Moscow, Russia
Ñîîáùåíèé: 429
Îòïðàâèòü ñîîáùåíèå äëÿ PhilD ñ ïîìîùüþ ICQ Îòïðàâèòü ñîîáùåíèå äëÿ PhilD ñ ïîìîùüþ Yahoo
Ïî óìîë÷àíèþ

2.php - ýòî ñòðàíèöà â TYPO èëè ïðîñòî ôàéë ëåæàùèé íà ñàéòå?
PhilD âíå ôîðóìà   Îòâåòèòü ñ öèòèðîâàíèåì
Ñòàðûé 27.01.2007, 21:46   #5
Nat
Íîâåíüêèé
 
Ðåãèñòðàöèÿ: 27.01.2007
Ñîîáùåíèé: 3
Ïî óìîë÷àíèþ

ÁÎËÜØÎÅ ñïàñèáî âñåì çà ïîìîùü, íî îøèáêà óæå íàéäåíà.
Ðåøåíèå áûëî â òîì,÷òîáû ïåðåíåòñè ôàéë 2.php â äðóãóþ ïàïêó - òàê è íå ñòàëî ïîíÿòíî, ïî÷åìó ññûëêà íà ôàéë 2.php â ñòàðîé ïàïêå íå ðàáîòàëà-ïóòü áûë ïðàâèëüíûé. Ïîñëå ýòîãî êàðòèíêà ñòàëà íîðìàëüíî ïîêàçûâàòüñÿ.
Nat âíå ôîðóìà   Îòâåòèòü ñ öèòèðîâàíèåì
Îòâåò


Âàøè ïðàâà â ðàçäåëå
Âû íå ìîæåòå ñîçäàâàòü íîâûå òåìû
Âû íå ìîæåòå îòâå÷àòü â òåìàõ
Âû íå ìîæåòå ïðèêðåïëÿòü âëîæåíèÿ
Âû íå ìîæåòå ðåäàêòèðîâàòü ñâîè ñîîáùåíèÿ

BB code is Âêë.
Ñìàéëû Âêë.
[IMG] êîä Âêë.
HTML êîä Âûêë.

Áûñòðûé ïåðåõîä

Ïîõîæèå òåìû
Òåìà Àâòîð Ðàçäåë Îòâåòîâ Ïîñëåäíåå ñîîáùåíèå
tt_news ñ ïðîèçâîëüíûì ðàñïîëîæåíèåì êàðòèíêè Âëàäèìèð Óìíîâ Îáùèå âîïðîñû 1 09.10.2005 16:55
Êàðòèíêè è /uploads/pics/... êàê ïîáîðîòü? S40 Îáùèå âîïðîñû 3 29.10.2004 23:26


×àñîâîé ïîÿñ GMT +4, âðåìÿ: 23:04.


Ðàáîòàåò íà vBulletin® âåðñèÿ 3.8.1.
Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.
Ïåðåâîä: zCarot

Õîñòèíã è òåõíè÷åñêàÿ ïîääåðæêà: TYPO3 Ëàáîðàòîðèÿ