Php parses base64 data to generate images,

Source: Internet
Author: User

Php parses base64 data to generate images,

This example describes how php parses base64 data to generate an image. We will share this with you for your reference. The details are as follows:

$ Base64 = "/9j/4 release/release + rZwumyxMjA/release/8 AAEQgAcgByAwEiAAIRAQMRAf/release/j5 + v/release + jp6vLz9PX29/j5 + /queue + queue/CPxoAbLJuOB0/queue + queue/jUaffX606b/WGgBlFFFAEkTZ + RuhpjDaxHpQn31 + tOm/queue + queue/rBTKfD/queue + queue/ 8 AdNJsb + signature/2Q = "; $ img = base64_decode ($ base64); // $ a = file_put_contents ('. /test.jpg ', $ img); // Save the image and return the number of bytes. // print_r ($ a); Header ("Content-type: image/jpeg "); // directly output jpg image echo $ img;

Run the following command:

PS: I would like to recommend several online image tools for your reference.

Online tools for converting images to Base64 encoding:
Http://tools.jb51.net/transcoding/img2base64

Online image format conversion (jpg/bmp/gif/png) tool:
Http://tools.jb51.net/aideddesign/picext

ICO icon generation tool:
Http://tools.jb51.net/aideddesign/ico_img

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.