| | |
| Stránka: 1 z 1
| [ Príspevok: 1 ] | |
Autor | Správa |
---|
Registrovaný: 27.01.11 Prihlásený: 08.05.12 Príspevky: 73 Témy: 29 |
Ahojte, mam taky problem, mam tento scriptik:
Kód: $data = getimagesize($image); $width = intval($data[0]); $height = intval($data[1]); $hex = "FF00FF"; $oldhex = "FF00FF"; $im = imagecreatefromPNG($image); $color = imagecolorallocatealpha($im,hexdec(substr($hex,0,2)),hexdec(substr($hex,2,2)),hexdec(substr($hex,4,6)),127); $color2 = imagecolorallocate($im,hexdec("00"),hexdec("00"),hexdec("00")); for($cloneH=0;$cloneH<$height;$cloneH++) { for($x=0;$x<$width;$x++) { if(!colormatch($im,$x,$cloneH, "FFFF00")) imagesetpixel($im, $x, $cloneH, $color); } } $dest = imagecreatetruecolor(355, 252);
//imagecopy($dest, $im, 0, -71, 1, 13, 535, 336);
header("Content-Type: {$data['mime']}"); imagePNG($im); function colormatch($image,$x,$y,$hex) { $rgb = imagecolorat($image,$x,$y); $r = ($rgb >> 16) & 0xFF; $g = ($rgb >> 8) & 0xFF; $b = $rgb & 0xFF; $r2 = hexdec(substr($hex,0,2)); $g2 = hexdec(substr($hex,2,2)); $b2 = hexdec(substr($hex,4,6)); if( $r == $r2 && $b == $b2 && $g == $g2 ) return true; return false; }
A tuto je chyba: if(!colormatch($im,$x,$cloneH, "FFFF00"))
Teraz tam mam zltu farbu, zlta farba na obrazku 100% je a som aj zistoval aku hex farbu ma a nic sa nedeje... Ked tam dam ciernu farbu(FFFFFF) tak mi to funguje.... Nechapem..
|
|
| Stránka: 1 z 1
| [ Príspevok: 1 ] | |
| Nemôžete zakladať nové témy v tomto fóre Nemôžete odpovedať na témy v tomto fóre Nemôžete upravovať svoje príspevky v tomto fóre Nemôžete mazať svoje príspevky v tomto fóre
|
|