joypixels / emojione

[Archived] The world's largest independent emoji font. Maintained at https://github.com/joypixels/emoji-toolkit.
https://www.joypixels.com
Other
4.46k stars 535 forks source link

The path to cdn.jsdelivr.net assets is broken (shortNameToImage function) #595

Closed anatoljevich closed 6 years ago

anatoljevich commented 6 years ago

In version 3.1.5 I'm getting the link https://cdn.jsdelivr.net/emojione/assets/3.1/png/1f497.png

while it should be https://cdn.jsdelivr.net/emojione/assets/3.1/png/32/1f497.png

It was working fine in version 3.1.2. I think there is a problem with a 'shortNameToImage' function ePath = (ns.emojiSize !== '32') ? ns.defaultPathPNG + ns.emojiSize + '/' : ns.imagePathPNG;

ghost commented 6 years ago

Having the same issue since the last update. All image paths are broken.

ghost commented 6 years ago

Found a way to fix this behaviour. You have to manually set the emoji size before the shortNameToImage function is executed, example:

// Manually set the size
emojione.emojiSize = 32;

var convertThis = ':smile:';

var converted = emojione.shortNameToImage(convertThis);
caseyahenson commented 6 years ago

This has been fixed in 3.1.6. The logic wasn't quite right with the ternary conditional as pointed out by @anatoljevich when no emoji size or image path is set.