Re: [PHP] findin colors in gif files
hi what gif is getting corrupted?, it works ok with the one you gave. To see what all those flag things are have a look at the gif spec at http://www.goice.co.jp/member/mo/formats/gif.html unpack puts the binary string into an array, flag gives some info as to the colour index table Tom At 09:43 PM 5/06/2002, freestylez wrote: >it almost works :) unfortunatly the gif file seems to be corrupted at some >point, >but anyhow - i am not good in these hex and bin things, could you explain me >the lines >that are dealing with hex conversino, flag, unpack this stuff? or do you >have a good link >explaining this? > >would be great! thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] findin colors in gif files
HI Just a thought, if your on a windows box you will need to ad a 'b' to the fiopen function like fopen($file, "br") Tom At 09:43 PM 5/06/2002, freestylez wrote: >it almost works :) unfortunatly the gif file seems to be corrupted at some >point, >but anyhow - i am not good in these hex and bin things, could you explain me >the lines >that are dealing with hex conversino, flag, unpack this stuff? or do you >have a good link >explaining this? > >would be great! thanks! -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] findin colors in gif files
Hi I think you have to use fread to load the binary file, here is a quick function that will do what you want. It a little bit safer than just blindly changing hex values in the file, it only checks the colour table. Tom "; $gif[$x] = $r2; $gif[$x+1] = $g2; $gif[$x+2] = $b2; $found = 1; endif; $x +=3; endwhile; endif; endif; if($found == 1): while(list($key,$val)=each($gif)): $newgif .= pack("C",$val); endwhile; $fd = fopen("test.gif", "w"); fwrite($fd,$newgif); fclose($fd); endif; } $filename = "vcd_1.gif"; change($filename,0xff,0x33,0x66,0x33,0x45,0xff); ?> At 05:06 PM 5/06/2002, johannes reichardt wrote: >hi everybody, i am new to this list & php >and i have a big question that i would love to be answered ;) > >i have a small gif file that has a part in #ff3366 colored - so what i >thought >is to do a mean hack for my website: instead of opening all images in a >graphicseditor and change the >color manually i could look up for that color (ff3366) in the image files >and replace it with something else, unfortunatly >i got stuck with this approach pretty soon. here is my problem: > >if i open the gif file in php (its attached to this mail) and convert it to >hex: > >$filetext1 = implode("",(@file("vcd_1.gif"))); >$filetext1 = bin2hex($filetext1); > } > >like this i get a string that looks like hex - but i cant find my ff3366 >anymore, >did i miss something really obvious? > >if i look up the gif file with an hexeditor (i use textpad) i can see it - >with php >its not findable > >any ideas? > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] findin colors in gif files
hi you will need to find the hex values for each individual number which i think should be (without the hash) 76763636 Tom At 05:06 PM 5/06/2002, johannes reichardt wrote: >hi everybody, i am new to this list & php >and i have a big question that i would love to be answered ;) > >i have a small gif file that has a part in #ff3366 colored - so what i >thought >is to do a mean hack for my website: instead of opening all images in a >graphicseditor and change the >color manually i could look up for that color (ff3366) in the image files >and replace it with something else, unfortunatly >i got stuck with this approach pretty soon. here is my problem: > >if i open the gif file in php (its attached to this mail) and convert it to >hex: > >$filetext1 = implode("",(@file("vcd_1.gif"))); >$filetext1 = bin2hex($filetext1); > } > >like this i get a string that looks like hex - but i cant find my ff3366 >anymore, >did i miss something really obvious? > >if i look up the gif file with an hexeditor (i use textpad) i can see it - >with php >its not findable > >any ideas? > > > >-- >PHP General Mailing List (http://www.php.net/) >To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] findin colors in gif files
hi everybody, i am new to this list & php and i have a big question that i would love to be answered ;) i have a small gif file that has a part in #ff3366 colored - so what i thought is to do a mean hack for my website: instead of opening all images in a graphicseditor and change the color manually i could look up for that color (ff3366) in the image files and replace it with something else, unfortunatly i got stuck with this approach pretty soon. here is my problem: if i open the gif file in php (its attached to this mail) and convert it to hex: $filetext1 = implode("",(@file("vcd_1.gif"))); $filetext1 = bin2hex($filetext1); } like this i get a string that looks like hex - but i cant find my ff3366 anymore, did i miss something really obvious? if i look up the gif file with an hexeditor (i use textpad) i can see it - with php its not findable any ideas? -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php