开发者

php hexdecimal conversion of png file

开发者 https://www.devze.com 2023-03-06 02:50 出处:网络
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

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

精彩评论

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