开发者

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;
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜