Explain how PHP can display 16-binary image data to a Web page

Source: Internet
Author: User
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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.