javascript – So konvertieren Sie den Unicode eines Emojis in ein Bild
PHP中文网
PHP中文网 2017-05-16 13:27:01
0
3
881

Ich erstelle eine Chat-Anwendung und habe jetzt Emoticons importiert, aber ich bin auf ein neues Problem gestoßen, das heißt, ich kann Emoji-Unicode-Codes nur empfangen, wenn ich sie sende. Wenn ich beispielsweise ein Smiley-Gesicht erhalte: smile: , wie kann ich es dann so inumwandeln? Gibt es jemanden, der ein solches Projekt durchgeführt hat? Können Sie uns Ihre Erfahrungen mitteilen?

PHP中文网
PHP中文网

认证0级讲师

Antworte allen (3)
伊谢尔伦

EmojiOne

支持JSPHPAndroidiOSJava

JS

https://github.com/Ranks/emojione/blob/master/lib/js

还需要下载对应的图片或字体 https://www.emojione.com/deve...
放的位置参照官方例子

使用方法

emojione.shortnameToImage(":see_no_evil: or :'-) or emoji charset");

支持格式

  • :emoji:,比如:see_no_evil:是那个

  • 象形符号,比如':-)

  • unicode字符

    漂亮男人

    js获取到unicode字符之后,会对它进行正则过滤,转换成图片名称对应的字符,然后组装图片路径,这样就可以显示了

      过去多啦不再A梦

      weChatEmoji

      var qqfaceMap = {"/::)":"0","/::~":"1","/::B":"2","/::|":"3","/:8-)":"4","/::<":"5","/::$":"6","/::X":"7","/::Z":"8","/::'(":"9","/::-|":"10","/::@":"11","/::P":"12","/::D":"13","/::O":"14","/::(":"15","/::+":"16"," /:--b":"17","/::Q":"18","/::T":"19","/:,@P":"20","/:,@-D":"21","/::d":"22","/:,@o":"23","/::g":"24","/:|-)":"25","/::!":"26","/::L":"27","/::>":"28","/::,@":"29","/:,@f":"30","/::-S":"31","/:?":"32","/:,@x":"33","/:,@@":"34","/::8":"35","/:,@!":"36","/:!!!":"37","/:xx":"38","/:bye":"39","/:wipe":"40","/:dig":"41","/:handclap":"42","/:&-(":"43","/:B-)":"44","/:<@":"45","/:@>":"46","/::-O":"47","/:>-|":"48","/:P-(":"49","/::'|":"50","/:X-)":"51","/::*":"52","/:@x":"53","/:8*":"54","/:pd":"55","/:":"56","/:beer":"57","/:basketb":"58","/:oo":"59","/:coffee":"60","/:eat":"61","/:pig":"62","/:rose":"63","/:fade":"64","/:showlove":"65","/:heart":"66","/:break":"67","/:cake":"68","/:li":"69","/:bome":"70","/:kn":"71","/:footb":"72","/:ladybug":"73","/:shit":"74","/:moon":"75","/:sun":"76","/:gift":"77","/:hug":"78","/:strong":"79","/:weak":"80","/:share":"81","/:v":"82","/:@)":"83","/:jj":"84","/:@@":"85","/:bad":"86","/:lvu":"87","/:no":"88","/:ok":"89","/:love":"90","/:":"91","/:jump":"92","/:shake":"93","/:":"94","/:circle":"95","/:kotow":"96","/:turn":"97","/:skip":"98","/:oY":"99","/:#-0":"100","/:hiphot":"101","/:kiss":"102","/:<&":"103","/:&>":"104"}; var str = "/::\\)|/::~|/::B|/::\\||/:8-\\)|/::<|/::$|/::X|/::Z|/::'\\(|/::-\\||/::@|/::P|/::D|/::O|/::\\(|/::\\+|/:--b|/::Q|/::T|/:,@P|/:,@-D|/::d|/:,@o|/::g|/:\\|-\\)|/::!|/::L|/::>|/::,@|/:,@f|/::-S|/:\\?|/:,@x|/:,@@|/::8|/:,@!|/:!!!|/:xx|/:bye|/:wipe|/:dig|/:handclap|/:&-\\(|/:B-\\)|/:<@|/:@>|/::-O|/:>-\\||/:P-\\(|/::'\\||/:X-\\)|/::\\*|/:@x|/:8\\*|/:pd|/:|/:beer|/:basketb|/:oo|/:coffee|/:eat|/:pig|/:rose|/:fade|/:showlove|/:heart|/:break|/:cake|/:li|/:bome|/:kn|/:footb|/:ladybug|/:shit|/:moon|/:sun|/:gift|/:hug|/:strong|/:weak|/:share|/:v|/:@\\)|/:jj|/:@@|/:bad|/:lvu|/:no|/:ok|/:love|/:|/:jump|/:shake|/:|/:circle|/:kotow|/:turn|/:skip|/:oY|/:#-0|/:hiphot|/:kiss|/:<&|/:&>"; var reg = new RegExp(str,'g'); result = '这是简单的测试/::Z呵呵/:wipe效果不错吧'.replace(reg,function(r){ return ''; }); var a = document.getElementsByTagName('p')[0]; a.innerHTML = result;

      https://github.com/hu-qi/weCh...

        Neueste Downloads
        Mehr>
        Web-Effekte
        Quellcode der Website
        Website-Materialien
        Frontend-Vorlage
        Über uns Haftungsausschluss Sitemap
        Chinesische PHP-Website:Online-PHP-Schulung für das Gemeinwohl,Helfen Sie PHP-Lernenden, sich schnell weiterzuentwickeln!