Both PHP and JavaScript libraries now have wider range of available properties. The following are available for both libraries.
emojiVersion
(str) - Used only to direct CDN path. This is a 2-digit version (e.g. '3.1'). Not recommended for usage below 3.0.0.emojiSize
(str) Default:32
- Used only to direct CDN path for non-sprite PNG usage. Available options are '32', '64', and '128'.imagePathPNG
(str) - Defaults to CDN (jsdelivr) path. Setting as alternate path overwritesemojiSize
option.fileExtension
(str) - Defaults to .png. Set to '.svg' if using premium assets (.svg) locally.greedyMatch
(bool) Default:false
- Whentrue
, matches non-fully-qualified Unicode values.blacklistChars
(str) Default:''
- Comma-separated list of characters that should not be replaced. For example, setting to'#,*'
ensures pound and asterisk symbols are not replaced.imageTitleTag
(bool) Default:true
- Whenfalse
, removes title attribute from tag.sprites
(bool) Default:false
- Whentrue
, sprite markup will be used. Sprite CSS and PNG assets must be additionally included.spriteSize
(str) Default32
- Alternate size is64
.unicodeAlt
(bool) Defaultfalse
- Whentrue
, sets unicode char as alt attribute for ability to copy image as unicode.ascii
(bool) Defaultfalse
- Whentrue
, matches ASCII characters (inunicodeToImage
andshortnameToImage
functions).riskyMatchAscii
(bool) Defaultfalse
- Whentrue
, matches ASCII characters not encapsulated by spaces. Can cause issues when matching (e.g.C://filepath
or<button>.</button>
both contain ASCII chars).
Below there are some examples of how you will actually use the libraries to convert Unicode emoji characters to :shortnames: and :shortnames: to emoji images.
.toShort(str) - native unicode -> shortnames
This demo shows you how to take native unicode emoji input, such as that from your mobile device, and translate it to their corresponding shortnames. (we recommend this for database storage)
.shortnameToImage(str) - shortname -> images
This demo shows you how to take input containing only shortnames and translate it directly to EmojiOne images. (when displaying the unified input to clients)
.toImage(str) - native unicode + shortnames -> images (mixed input)
This demo shows you how to take input containing both native unicode emoji and shortnames, and translate it into EmojiOne images for display.
toShort($str) - native unicode -> shortnames
This demo shows you how to take native unicode emoji input, such as that from your mobile device, and translate it to their corresponding shortnames. (we recommend this for database storage)
shortnameToImage($str) - shortname -> images
This demo shows you how to take input containing only shortnames and translate it directly to EmojiOne images. (when displaying the unified input to clients)
toImage($str) - native unicode + shortnames -> images (mixed input)
This demo shows you how to take input containing both native unicode emoji and shortnames, and translate it into EmojiOne images for display.
Note: As of version 1.4.1 the following implementation has been deprecated. It's included in the library for backwards compatibility but will be removed at a later date.
::toShort($str) - native unicode -> shortnames
This demo shows you how to take native unicode emoji input, such as that from your mobile device, and translate it to their corresponding shortnames. (we recommend this for database storage)
::shortnameToImage($str) - shortname -> images
This demo shows you how to take input containing only shortnames and translate it directly to EmojiOne images. (when displaying the unified input to clients)
::unicodeToImage($str) - native unicode -> images
This demo shows you how to take native unicode emoji input, such as that from your mobile device, and translate it directly to EmojiOne images. (would be great for a live editor preview)
::toImage($str) - native unicode + shortnames -> images (mixed input)
This demo shows you how to take input containing both native unicode emoji and shortnames, and translate it into EmojiOne images for display.
Or
Emojione.transform(string: "Rocket.Chat: :rocket:")
Change from shortnames to native unicode emoji.
Easily add shortname autocomplete functionality to any text input on your page.
With one quick step you can start converting common ASCII smileys to their corresponding images.
Change from the native unicode emoji in the resulting alt tags to their shortnames instead.
Display converted Emoji in a preview box as the user is typing.
Stick a class of .emojione-convert on any HTML element and automatically convert native unicode emoji and/or shortnames to images after page load.
Converts unicode input to shortnames once the user submits the form.
With an additional CSS file you can use EmojiOne as resizable PNG sprites (up to 64x64).
This sprite method requires no extra CSS, and is infinitely resizable.