Advertisement:

Author Topic: Parser to change Emojis for images in posts for PC users.  (Read 5228 times)

Offline Gluz

  • Native Language Support Specialist
  • Sr. Member
  • *
  • Posts: 961
  • Gender: Male
Parser to change Emojis for images in posts for PC users.
« on: March 19, 2016, 02:33:04 PM »
This was meant to be a MOD, but the Customization team says that it fits more in the Tip and Tricks board than a MOD, so here you have it.

The main purpose is to allow the PC users to see the actual emoji that the mobile users post, because only Safari in OS X show them as far as I know.
To mobile users it shows it's own set for each mobile OS, but can force the parse for that devices too, so all users will see the exact same emoji.

The images are the emojis from Apple, and have almost all the emojis available until 2015 updates of WhatsApp, just some are missing from the table I used to generate the sheet.





Emoji parser

Information
This MOD parses Emojis (Multibyte Unicode Characters) posted by iOS or Android users and replace them with an actual image for not mobile view.

Example:
😉 →

NOTE: Requires SMF 2.0.10 or above because of the UTF8MB4 fix to store Emojis (Multibyte Unicode Characters) safely in the database. Note that previewing post with emojis it's still broken and says that the body message is empty.


Usage
Just install, the emojis in posts should be working now in all the devices, and have a setting to force mobile device substitution.
To disable it just uninstall the mod.


© 2015 v 1.1.0
@mod           Emoji parser
@author       Gluz
@license       MIT https://opensource.org/licenses/MIT
@using          https://github.com/emanuele45/Mobile-Device-Detect (part of codes)
@based on   https://github.com/iamcal/php-emoji
@reference   http://unicodey.com/emoji-data/table.htm
@images      © Apple Inc.


Changelog:

Version 1.1.0
-Add mobile device detect and a setting to force emoji parse on mobile devices.

Version 1.0
-Initial Release.




Before




After




Download Here
« Last Edit: March 19, 2016, 02:46:14 PM by Gluz »
Need help with PHP, HTML, CSS, Themes or MODs?

Quote
Think in spanish, habla en inglés.

Offline Chalky

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,360
  • Gender: Female
  • If in doubt, give me beer...
    • ChalkCat
Re: Parser to change Emojis for images in posts for PC users.
« Reply #1 on: July 11, 2016, 05:25:29 AM »
Thanks for this!  It does everything it should but with one problem: with the package installed I get  symbols appearing throughout the text on all posts.  It appears after colons, capital letters, attaches itself to the forum smileys.... any ideas?

There is something funky with my forum, in that even though my database is UTF-8, and we've never had any of the problems associated with non-UTF-8 forums, my forum itself still thinks it's ISO and is using the ISO language packs for everything. I'm guessing that's the issue but wanted to see whether you had any suggestions before I embark on that mission...

Offline Study Force

  • SMF Hero
  • ******
  • Posts: 3,101
    • @studyforceps on Twitter
    • Study Force
Re: Parser to change Emojis for images in posts for PC users.
« Reply #2 on: July 11, 2016, 03:54:01 PM »
Thanks for the work, will wait till all the wrinkles are ironed out before using!

Offline Chalky

  • SMF Friend
  • SMF Hero
  • *
  • Posts: 3,360
  • Gender: Female
  • If in doubt, give me beer...
    • ChalkCat
Re: Parser to change Emojis for images in posts for PC users.
« Reply #3 on: July 12, 2016, 06:13:31 PM »
Just reporting back that I have now converted my forum to full utf-8, a job that's needed doing for ages but I was dreading it because my forum is very heavily modded and the database was an unnerving mix of utf-8 and latin1 tables from being shifted around.  As a result, this mod now works perfectly!!!  Thank you!!

If anyone wants to see the results, you can see here  http://chalkcat.com/index.php?topic=4740.msg98198#msg98198

Offline Gluz

  • Native Language Support Specialist
  • Sr. Member
  • *
  • Posts: 961
  • Gender: Male
Re: Parser to change Emojis for images in posts for PC users.
« Reply #4 on: July 13, 2016, 02:37:28 PM »
Just reporting back that I have now converted my forum to full utf-8, a job that's needed doing for ages but I was dreading it because my forum is very heavily modded and the database was an unnerving mix of utf-8 and latin1 tables from being shifted around.  As a result, this mod now works perfectly!!!  Thank you!!

If anyone wants to see the results, you can see here  http://chalkcat.com/index.php?topic=4740.msg98198#msg98198
I forgot to mention that the forum and the database has to be in UTF-8 to work well with emojis.

If you want to be able to post emojis from your PC browser you need ane of the addons for that browser:
Chrome: https://chrome.google.com/webstore/detail/emoji-input-by-emojistuff/immhpnclomdloikkpcefncmfgjbkojmh
Firefox: https://addons.mozilla.org/es/firefox/addon/emoji-cheatsheet/



Thanks for the work, will wait till all the wrinkles are ironed out before using!
There are only a few emojis from the recent updates that are not in the style sheet,  it has a total of 1620 emojis to show.
Need help with PHP, HTML, CSS, Themes or MODs?

Quote
Think in spanish, habla en inglés.