Hi
I received a huge data as post vars.like the following
color=>5
height=>205
width=>168
row204=>,16777215,4,14035498,1,13172736,1,13434880,1,13500416,2,13565952,1,13697024,1,13762560,2,13893632,1,14024704,2,14286848,3,14352384,3,14483456,2,14614528,2,14680064,3,14811136,2,14876672,5,14942208,1,15007744,3,15073280,2,15138816,1,15073280,2,15138816,1,15204352,8,15400960,3,15335424,1,15400960,2,15532032,1,15597568,2,15532032,2,15597568,3,15663104,2,15728640,1,15794176,3,15859712,1,15794176,1,15728640,1,15794176,2,15859712,9,15925248,1,15859712,3,15794176,1,15859712,2,15794176,1,15728640,1,15859712,2,15794176,3,15728640,1,15663104,4,15597568,4,15532032,2,15466496,1,15400960,3,15335424,2,15204352,1,15138816,2,15204352,3,15138816,3,15073280,3,15138816,1,15073280,1,15007744,1,14942208,1,15073280,1,15007744,1,14942208,1,14876672,1,14811136,1,14876672,1,14811136,1,14745600,1,14811136,2,14745600,2,14614528,1,14548992,1,14483456,2,14417920,1,14352384,4,14221312,1,14090240,1,13959168,1,13762560,3,13697024,2,13565952,1,13500416,1,13369858,1,16571612,1,16777215,3
row203=>,16777215,4,14035498,1,13107200,1,13369344,1,13434880,1,13500416,1,13631488,1,13762560,1,13828096,2,13959168,1,14090240,1,14155776,1,14352384,1,14286848,1,14221312,1,14286848,1,14352384,2,14483456,2,14548992,1,14614528,1,14680064,2,14614528,1,14745600,1,14811136,3,14876672,6,14942208,1,15007744,1,15073280,2,15007744,1,15073280,3,15138816,4,15073280,1,15138816,1,15204352,1,15466496,3,15532032,2,15466496,2,15532032,4,15597568,2,15663104,2,15728640,2,15794176,6,15859712,3,15925248,9,15794176,1,15728640,1,15859712,4,15794176,6,15859712,1,15794176,1,15728640,1,15663104,3,15597568,3,15532032,1,15466496,3,15532032,1,15466496,3,15400960,1,15269888,1,15138816,3,15204352,2,15138816,1,15204352,1,15138816,1,15073280,1,15007744,2,15073280,2,15007744,1,14942208,1,14876672,4,14811136,2,14745600,2,14811136,1,14745600,3,14614528,1,14548992,1,14483456,2,14417920,1,14352384,1,14286848,2,14352384,1,14155776,2,14024704,1,13828096,2,13762560,1,13697024,2,13565952,1,13500416,1,13303808,1,16234423,1
——- ———–etc——- ————–etc——-
up to row1=>
we use the following code for regenerating the image .
<?php
error_reporting(0);
$w = (int)$_POST[‘width’];
$h = (int)$
// create the image with desired width and height
$img = imagecreatetruecolor($w, $h);
// now fill the image with blank color
// do you remember i wont pass the 0xFFFFFF pixels
// from flash?
imagefill($img, 0, 0, 0xFFFFFF);
$rows = 0;
$cols = 0;
global $temp;
$temp = 0;
// now process every POST variable which
// contains a pixel color
for($rows = 0; $rows < $h; $rows++){
// convert the string into an array of n elements
$c_row = explode(“,”, $_POST[‘row’ . $rows]);
for($cols = 0; $cols <= $w; $cols++){
// get the single pixel color value
$value = dechex((int)$c_row[$cols]);
//$value = hexdec((int)$c_row[$cols]);
// if value is not empty (empty values are the blank pixels)
if(strlen($value)>2){
for($m = 0; $m < $temp; $m++)
{
$hex = $value;
// get the hexadecimal string (must be 6 chars length)
// so add the missing chars if needed
/* while(strlen($hex) < 6){
$hex = “0” . $hex;
}*/
// convert value from HEX to RGB
$r = hexdec(substr($hex, 0, 2));
$g = hexdec(substr($hex, 2, 2));
$b = hexdec(substr($hex, 4, 2));
// allocate the new color
// N.B. teorically if a color was already allocated
// we dont need to allocate another time
// but this is only an example
$test = imagecolorallocate($img, $r, $g, $b);
// and paste that color into the image
// at the correct position
imagesetpixel($img, $cols, $rows, $test);
}
}
else
{
$temp = $c_row[$cols];
}
}
}
// print out the correct header to the browser
header(“Content-type:image/jpeg”);
// display the image
//imagejpeg($img, $next_image, 90);
imagejpeg($img, ‘abc.jpg’, 90);
?>
An image with bad look is created with the above code
Can anyone Help me to Create the clear image using php code with the data from flah.