Hello all
the aim is to cut and append one below other a long rectangular image of
4500*80 pixels png image using php script with gd.
<?php
$file="12S.txt";
$handle=fopen($file, "r+");
$A=0;
$G=0;
$C=0;
$T=0;
$img = imagecreate(4500,80);
$white = imagecolorallocate($img, 255,255,255);
$green=imagecolorallocate($img, 0, 128, 0);
$black=imagecolorallocate($img, 0, 0, 0);
$red=imagecolorallocate($img, 255, 0, 0);
$blue=imagecolorallocate($img, 0, 0, 255);
$x1=40;
$y1=40;
$x2=43;
$y2=80;
while(!feof($handle))
{ $readchar=fgetc($handle);
$readchar=strtoupper($readchar);
if($readchar=='A')
{
$A++;
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $green);
$x1=$x1+6;
$x2=$x2+6;
}
else if($readchar=='G')
{
$G++;
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $black);
$x1=$x1+6;
$x2=$x2+6;
}
else if($readchar=='C')
{
$C++;
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $blue);
$x1=$x1+6;
$x2=$x2+6;
}
else if($readchar=='T')
{
$T++;
imagefilledrectangle($img, $x1, $y1, $x2, $y2, $red);
$x1=$x1+6;
$x2=$x2+6;
}
fclose($handle);
header("Content-type: image/png");
imagepng($img);
imagedestroy($img);
?>
your valuable suggestions and comments are highly appreciated.
with regards
s.mahalingam