Есть скрипт картинки. В Опере запускается не всегда, а в эксплорер пишет такие строки: Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in ... on line 52 Warning: imagefill(): supplied argument is not a valid Image resource in... on line 53 Warning: imagesy(): supplied argument is not a valid Image resource in... on line 93 Warning: imagecopy(): supplied argument is not a valid Image resource in... on line 111 Warning: imagecopy(): supplied argument is not a valid Image resource in... on line 111 Warning: imagecopy(): supplied argument is not a valid Image resource in... on line 111 Warning: imagecopy(): supplied argument is not a valid Image resource in... on line 111 Warning: imagecopy(): supplied argument is not a valid Image resource in... on line 111 Warning: imagepng(): supplied argument is not a valid Image resource in... on line 156 Warning: imagedestroy(): supplied argument is not a valid Image resource in... on line 157 Вот сам код | Код | <?php header('Content-type: image/png'); require("connectdb.inc.php");
function win2uni($s) { $s = convert_cyr_string($s,'w','i'); // преобразование win1251 -> iso8859-5 // преобразование iso8859-5 -> unicode: for ($result='', $i=0; $i<strlen($s); $i++) { $charcode = ord($s[$i]); $result .= ($charcode>175)?"&#".(1040+($charcode-176)).";":$s[$i]; } return $result; }
$el=imagecreatefromjpeg("images/tree.jpg"); $otg=10; $dg=10; $dv=30; $imw=imagesx($el); $imh=imagesy($el); $col=0x0000FF; $fs=12; $fn='arial.ttf'; $lo=5; $lc=0x00FF00;
$user=$_COOKIE['login']; $sql=mysql_query("select*from users where parent4='$user'"); $num=mysql_num_rows($sql); if($num!="0") $ur=4; else { $sql=mysql_query("select*from users where parent3='$user'"); $num=mysql_num_rows($sql); if($num!="0") $ur=3; else { $sql=mysql_query("select*from users where parent2='$user'"); $num=mysql_num_rows($sql); if($num!="0") $ur=2; else { $sql=mysql_query("select*from users where parent='$user'"); $num=mysql_num_rows($sql); if($num!="0") $ur=1; else $ur=0; } } }
$image = imagecreatetruecolor($imw*$num+$otg+$dg*($num-1),(4+$ur)*$imh+(3+$ur)*$dv+$imh); imagefill($image, 0, 0, 0xFFFFFF);
$i1=0; $i2=0; $i3=0; $i4=0; $sql=mysql_query("select*from users where parent='$user'"); while ($row=mysql_fetch_array($sql)) { $i1=$i1+1; $prs[1][$i1]=$row['user']; $us1=$row['user'];
$sql2=mysql_query("select*from users where parent='$us1'"); while ($row2=mysql_fetch_array($sql2)) { $i2=$i2+1; $prs[2][$i2]=$row2['user']; $us2=$row2['user'];
$sql3=mysql_query("select*from users where parent='$us2'"); while ($row3=mysql_fetch_array($sql3)) { $i3=$i3+1; $prs[3][$i3]=$row3['user']; $us3=$row3['user'];
$sql4=mysql_query("select*from users where parent='$us3'"); while ($row4=mysql_fetch_array($sql4)) { $i4=$i4+1; $prs[4][$i4]=$row4['user']; } } } }
for ($i=1; $i<=count($prs[$ur]); $i++) $cx[$ur][$i]=$otg+($i-1)*($imw+$dg); $y=imagesy($image)-$imh;
while ($ur!=-5) { $par="aaaaaaaaaaaaaaaaaaaa"; $pc=1; $cd=0;
for ($it=1; $it<=count($prs[$ur])+1; $it++) { $s=$prs[$ur][$it]; $el=imagecreatefromjpeg("images/tree.jpg"); $coord=imagettfbbox($fs, 0, $fn, $s); $width = $coord[2] - $coord[0]; $height = $coord[1] - $coord[7]; imagettftext($el, $fs, 0, ($imw-$width)/2, ($imh+$height)/2, $col, $fn, win2uni($s)); $x=$cx[$ur][$it]; imagecopy($image, $el, $x, $y, 0, 0, $imw, $imh); $sql2=mysql_query("select*from users where user='$s'"); $row2=mysql_fetch_array($sql2); if ($row2['parent']==$par) $pc=$pc+1; if (($row2['parent']!=$par)&&($it==1)) {$par=$row2['parent']; $xn=$cx[$ur][$it];} if (($row2['parent']!=$par)&&($it!=1)) { $cd=$cd+1; $xk=$x-$dg;
if ($pc==1) { $cx[$ur-1][$cd]=$xn; imageline ($image, ($xk+$xn)/2, $y-$lo, ($xk+$xn)/2, $y-$dv+$lo, $lc); }
if ($pc==2) { $cx[$ur-1][$cd]=($xk+$xn)/2-$imw/2; imageline ($image, $xn+$imw/2, $y-$lo, ($xk+$xn)/2, $y-$dv+$lo, $lc); imageline ($image, $xk-$imw/2, $y-$lo, ($xk+$xn)/2, $y-$dv+$lo, $lc); }
if ($pc==3) { $cx[$ur-1][$cd]=($xk+$xn)/2-$imw/2; imageline ($image, $xn+$imw/2, $y-$lo, ($xk+$xn)/2, $y-$dv+$lo, $lc); imageline ($image, $xk-$imw/2, $y-$lo, ($xk+$xn)/2, $y-$dv+$lo, $lc); imageline ($image, ($xk+$xn)/2, $y-$lo, ($xk+$xn)/2, $y-$dv+$lo, $lc); }
$par=$row2['parent']; $pc=1; $xn=$xk+$dg; } }
$y=$y-$dv-$imh; $ur=$ur-1; }
imagepng($image); imagedestroy($image); ?>
|
Это сообщение отредактировал(а) igorz89 - 10.11.2008, 18:52
|