php解析base64数据生成图片的方法
程序员文章站
2024-03-05 14:00:36
本文实例讲述了php解析base64数据生成图片的方法。分享给大家供大家参考,具体如下:
$base64 = "/9j/4aaqskzjrgabaqeakacqa...
本文实例讲述了php解析base64数据生成图片的方法。分享给大家供大家参考,具体如下:
$base64 = "/9j/4aaqskzjrgabaqeakacqaad/4qcmrxhpzgaatu0akgaaaagabqesaamaaaabaaeaaaeaaauaaaabaaaasgebaauaaaabaaaaugeoaamaaaabaaiaaidpaaqaaaabaaaawgaaaaaaaacqaaaaaqaaajaaaaabaaogaqadaaaaaqabaacgagaeaaaaaqaaahkgawaeaaaaaqaaahiaaaaa/9saqwaffrcbfxmfgxkbiyefjs9omi8rky9freg4tnbjdnruy21rfiyyl3yeqyzrbzvtnam4vsjkyhiv2+rzwumyxmja/9saqwehiymvks9bmjjbwibtgmdawmdawmdawmdawmdawmdawmdawmdawmdawmdawmdawmdawmdawmdawmdawmdawmda/8aaeqgacgbyaweiaairaqmraf/eab8aaaefaqebaqebaaaaaaaaaaabagmebqyhcakkc//ealuqaaibawmcbamfbqqeaaabfqecawaeequsitfbbhnryqcicrqygzghccncscevuthwjdnicoijchyxgbkajsynkckqndu2nzg5okneruzhselku1rvvldywvpjzgvmz2hpann0dxz3ehl6g4sfhoeiiyqsk5svlpeymzqio6slpqeoqaqys7s1tre4ubrcw8tfxsfiycrs09tv1tfy2drh4upk5ebn6onq8flz9px29/j5+v/eab8baambaqebaqebaqeaaaaaaaabagmebqyhcakkc//ealuraaibagqeawqhbqqeaaecdwabagmrbauhmqysqvehyxetijkbcbrckagxwqkjm1lwfwjy0qowjdthjfexgbkajicokso1njc4otpdrevgr0hjslnuvvzxwflay2rlzmdoawpzdhv2d3h5eokdhiwgh4ijipktljwwl5izmqkjpkwmp6ipqrkztlw2t7i5usldxmxgx8jjytlt1nxw19jz2ulj5oxm5+jp6vlz9px29/j5+v/aaawdaqaceqmrad8a6giiigaooqf5scl+daepihu4phmqepquswosc0uwjvph939app8a9n9ahooasczt1ykecg6hnvkasdkhfafyioem7n+dtagjipalrrrqauuuuafffqzv/cpxoabljuob0/nudffmaoopyixph50anoqtes9swptr+6b1wgcoinpgu56j1ptabto5ch9vsm0uawwqrkdkwq8l4o09dvikauuuuaix2qt6vujycmp5zhqpwokybrrrqadalkoxqi/juaffx606b/wggblfffaektz+ruhpjdaxhpqn31+tom/1hoazrrrqavajbcgpeqts255i/ggceiiikbbcfea9qiqs4++ppudmaooooaklceyozeo6ioqkjrh82do96ai6kmzoierk+1n3xr91mn3oai12je3qdkjjyst3pxcueasgaooooakfd/rbtkfd/rbqbzooopaq3a6goasyruqiq1maoopvg5gpwgb6kfxe34cmo5c5nompzbr0fmoakkkkacpnoepkjkdrudoiba49+kag0u6rdrku2gaqsafot6co6sqlhm+taelfffiaqtkm1vy1zprqhxboaq06mhxbpskzspwasmarhle+ppkkkaciiigaooooafkwzsj0plfabjwotadkxe2ktdkzgmxffvt6qbrrrqauuuuanda4waruhq89pwrvfafoip2hu9okyyxhtbpgr0u7y/8adnjsb+6fyoasinifz2xuiwafeoaaivuscavyjjcd1prtgabgdflsakkkkaciiigaooooakkkkaciiigaooooakkkkaciiigaooooakkkkap/2q=="; $img = base64_decode($base64); //$a = file_put_contents('./test.jpg', $img);//保存图片,返回的是字节数 //print_r($a); header( "content-type: image/jpeg");//直接输出显示jpg格式图片 echo $img;
运行效果图如下:
ps:这里再为大家推荐几款在线图片工具供大家参考使用
图片转换为base64编码在线工具:
在线图片格式转换(jpg/bmp/gif/png)工具:
ico图标在线生成工具:
更多关于php相关内容感兴趣的读者可查看本站专题:《php图形与图片操作技巧汇总》、《php基本语法入门教程》、《php运算与运算符用法总结》、《php面向对象程序设计入门教程》、《php网络编程技巧总结》、《php数组(array)操作技巧大全》、《php字符串(string)用法总结》、《php+mysql数据库操作入门教程》及《php常见数据库操作技巧汇总》
希望本文所述对大家php程序设计有所帮助。
下一篇: 子窗口给父窗口赋值实现思路及案例演示