How does PHP display the 16 binary image data to the Web? The following small series to bring you a PHP inside the 16 binary image data displayed on the HTML IMG tag (Implementation method). Small series feel very good, now share to everyone, also for everyone to make a reference. We hope to help you.
Customer Company's SQLServer2008 of a production database for more than 1 years up to 18G of the giant, originally the system inside the picture is directly stored in the form of 16 strings in the database. I don't have time to use PHP to display the HTML page.
<?php//read from the database: 16 binary form string of the picture $icon_hex = ' 89504E470D0A1A0A0000000D494844520000001C00000012010300000072C92CA ' .' 700000006504c5445000000ffffffa5d99fdd0000003f49444154089963603e6f60c000266cce1 ' . ' B1f8010cc07406220c2febcf10724e2ffe7ff7082f90303e76466062061ccc0603999d90048d81 ' . ' b30d809f3400800c0921ea36f9b656d0000000049454e44ae426082 '; $imgdata = Base64_encode (Pack (' h* ', $icon _hex)), Echo ' ';? >
Note that: when the img tag is displayed, be sure to add the file header description: "Data:image/png;base64," this place has been a long time for me.
Related recommendations:
Very strong PHP image processing class
A detailed explanation of how PHP prevents Thunder download method
How to implement Simple automatic search box prompt function in PHP