Home > Backend Development > PHP Tutorial > php base64 转图片的字符编码怎么设置

php base64 转图片的字符编码怎么设置

WBOY
Release: 2016-06-23 14:04:14
Original
1042 people have browsed it

  请问,php base64 的字符编码怎么设置,我现在把一张图片读取后编码是这样 
R0lGODlhFAAUAOZoAPj4+CIiIurq6iEhISAgIFRUVPb29uvr66amplJSUrm5uZ2dnRcXF4SEhBgYGHh4eDg4OC4uLjk5ORQUFEBAQDAwMF1dXRsbG9zc3BoaGh0dHbu7uyUlJX19fX9/f6ioqPr6+ldXV3d3dzExMaqqqkpKSikpKWNjY1BQUG9vb4GBgUFBQZSUlIaGhjw8PPPz8yQkJL29vcDAwBISErW1tYWFha6urpWVlQkJCQQEBCYmJicnJ21tbTU1NUdHR6+vrywsLIODg1lZWWlpaYKCgk9PT/f39/39/bi4uEJCQioqKu/v7z8/P3BwcL6+vvz8/DIyMp6enjc3N2xsbGBgYFpaWrCwsJKSkh4eHg4ODu3t7bGxsby8vExMTI6OjoyMjG5ubpycnM3NzU5OThwcHKenp97e3vn5+f///wAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAAACH5BAEAAGgALAAAAAAUABQAAAfRgGiCg4SFhoeIiYMxUmcWNYqFNBVnJSKRhBtQZ0JEmIMblCEqn4IKQGcFHolHMiwGpiZnCR2DCB+waAdcXQRLgk4cZ2OrghRKZQdoCygaEWICAh8wZ0VN0QcJGj0LaAU7GRcEAQMEESAnWAMBAWQZAQVoDRIMAx1fV1TCIRQ3LV4QGARogAZDlBETzAB4QuLCGR880LwAIcFBEAyCzoSpkguJAwBJLgl68EBLoi0TAKxIUQqNlRkAmIBp+SMLABdTWiLIYUSHhZY2cACAMKQlpkAAOw==

这是utf8的 但是我想弄成gbk,gb2312的 我试了 header 没用,请问我该怎么做
附上图片


回复讨论(解决方案)

  $thefilename='split.gif';
  $PSize = filesize($thefilename);
  $imgbinary = fread(fopen($thefilename, "rb"), filesize($thefilename));
  $base64=base64_encode ($imgbinary); 
这是我的代码 

图片与字符编码毫无关系

那我怎么得到 其他形式的 base64 编码 

我在c#中写了一个 base64读取的例子 得到的字符串就不一样  

内容不同,base64码值就不同

source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template