php hexdecimal conversion of png file
I am trying to get the image header from a png file. as the binary content show as neeble开发者_开发问答 how can i show it as hexadecimal? i tried to base_convert() but it is not returning the desired output as i am getting the poutput in hexadecimel editor. any help will be appreciated.I am trying to do it with php
Try this for size:
$filename = "C:\\wamp\\www\\projects\\cog.png";
$handle = fopen($filename, "rb");
$binContents = fread($handle, filesize($filename));
fclose($handle);
$hexContents = bin2hex($binContents);
echo $hexContents;
精彩评论