Hi Guys,
I am trying to get my PHP skills up to scratch switching to PHP Gd Library To Create Images From Existing One , I wanted To create Multiple images at one time how it is possible on fly . i have an application where i assign the color of an image according to color assigned to the category of the person means i have to colorize the images through PHP GD Library Filter I have an code here sharing with you that colorize the image according to the color assigned
But in this Example only one image is displayed while i wanted to create multiple images plz do help me. I am looking for Your Quick Response .
Thanks In Advance
Cheers:pinguin:
For ex: its working only one image displays
<?php //function to assign color and make backgroung white
function imagefilterhue($im,$r,$g,$b){
$rgb= $r+$g+$b;
$col = array($r/$rgb,$b/$rgb,$g/$rgb);
$height = imagesy($im);
$width = imagesx($im);
for($x=0; $x<$width; $x++){
for($y=0; $y<$height; $y++){
$rgb = imagecolorat($im, $x, $y);
$r = ($rgb >> 16) & 0xFF;
$g = ($rgb >> 8) & 0xFF;
$b = $rgb & 0xFF;
$newR = $r*$col[0] + $g*$col[2];
$newG = $r*$col[0] + $b
$newB = $r*$col[1] + $g
imagesetpixel($im, $x, $y,imagecolorallocate($im, $newR, $newG, $new?);
}
}
}
mysql_connect(“localhost”,”root”,””);
mysql_select_db(“icondb”);
$sql=”select * from icontbl”;
$result=mysql_query($sql);
if(!mysql_num_rows($result))
{
echo mysql_error();
}
else
{ $col=array();
while($row=mysql_fetch_array($result))
{
$col[]=$row[‘color’];
$nm[]=$row[‘name’];
$icnp[]=$row[‘iconpath’];
}
$value=implode(“,”,$col);
$vl=explode(“,”,$value);
$value=implode(“,”,$nm);
$nm=explode(“,”,$value);
$value=implode(“,”,$icnp);
$icnp=explode(“,”,$value);
for($i=0;$i<count($col);$i++) {
$vl[$i];
// “</br>”;
//echo “<img src=””.$icnp[$i].”” width=”30px” height=”30px” />”;
$nm[$i];
//echo “</br>”;
$icnp[$i];
//echo “</br>”;
}
for($i=0;$i<10; $i++)
{
$st[$i]=$vl[$i];
$st[$i]=substr($st[$i],1,6);
$st[$i];
$r=hexdec(substr($st[$i],0,2));
$g=hexdec(substr($st[$i],2,2));
$b=hexdec(substr($st[$i],4,2));
$im=imagecreatefromjpeg($icnp[$i]);
header(“Content-type:image/jpeg”);
imagefilterhue($im,$r,$g,$b);
imagejpeg($im);
//imagedestroy($im);
echo “<img src=”Huzecolorimage2.php” width=”40px” height=”40px”>”; }
}
?>
</body>
</html>
Accepting The Challengs_____________?