Enhance Smilies Support

https://www.phpbb.com/ideas/
Post Reply
Author:
EA117
Posted:
Mon Nov 25, 2019 7:06 pm
Rating:
Status:
New
User avatar
EA117
Registered User
Posts: 1181
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Enhance Smilies Support

Post by EA117 » Mon Nov 25, 2019 7:06 pm

Enhancement to provide three additional features/changes:
  • Support for SVG image files.
  • Support for text replacement in addition to image replacement.
  • Update default "out of the box" phpBB Smilies configuration to use phpBB's Emoji support.

Support for SVG image files. I think this should be possible without much change, since even the existing phpBB Smilies configuration is explicit about displayed image size. So even though SVG doesn't necessarily have an integral "size" implied like pixel images, the Smilies configuration already permits specifying "how large would you like to render this otherwise infinitely scalable image?"


Support for text replacement in addition to image replacement. This is the one which would involve the most change. In addition to being able to configure that a Smiley code such as :) should be mapped to a specific image, the proposal is that the Smilies configuration would optionally allow you to specify replacement text instead of an image.

So for example, I could use the phpBB Smilies system to define that :shrug: should be replaced with "Β―\_(ツ)_/Β―", or any other sequence of text the phpBB operator wants the :shrug: shortcode to mean. And most importantly, literal Emoji characters could be entered for this text replacement. Such that when configuring Smiley code :) you could specify it should be replaced with Emoji character "πŸ˜€" or similar, in order to leverage the high-quality Emoji support that phpBB already provides.

This is intended to extend the usefulness and flexibility of the phpBB Smilies system, by allowing the phpBB operator to continue being able to define their own "shortcodes" for things which might still be pixel-based images as they have been in the past, or might simply be Emojis or other meaningful text-based sequences, or might be SVG images.


Update default "out of the box" phpBB Smilies configuration to use phpBB's Emoji support. With the replacement text support implemented for Smilies, we are then also in a position where the default Smilies configuration "out of the box" in new phpBB installations could simply leverage the already-existing Emoji support in phpBB. Rather than the current set of 17x15 GIF images with bad aliasing, and rather than creating another set of pixel-based images that would need to be maintained.

Meaning the out-of-the box Smilies would already be scalable SVG images, because they will be displayed with the same Twemoji support that phpBB is already using for display of Emoji characters elsewhere. Nothing has stopped or prevented the phpBB operator from installing their own preferred images and/or text for Smilies. But we will have a clear, high resolution, high DPI-compatible set of Smilies as the default, because they are literally just Emoji text characters.


The Smilies configuration in phpBB could end up looking similar to this; with text input being disabled when an image is selected, and vice-versa:

Image

User avatar
AmigoJack
Registered User
Posts: 5659
Joined: Tue Jun 15, 2010 11:33 am
Location: γ‚°γƒͺーン ヒル ゾーン
Contact:

Re: Enhance Smilies Support

Post by AmigoJack » Tue Nov 26, 2019 8:33 am

EA117 wrote: ↑
Mon Nov 25, 2019 7:06 pm
:shrug: should be replaced with "Β―\_(ツ)_/Β―"
But that's just replacing text with text - it's the same as ":) should/could be replaced with ":-)". This also asks for circular loops when source and target are also defined vice versa.

But I undestand it in the sense to be able to replace a keyword/token/code into one single character (i.e. an Emoji) - it could also work the downgrade way for people not wanting Emojis but instead oldschool smilie(code)s.
The worst thing about censorship is β–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆβ–ˆ
Affin wrote: ↑
Tue Nov 20, 2018 9:51 am
The problem is probably not my English but you do not want to understand correctly.
...
We will not come anybody anyway, nevertheless, it's best to shit this.

User avatar
warmweer
Registered User
Posts: 3216
Joined: Fri Jul 04, 2003 6:34 am
Location: Van Allen Belt ... well actually Belgium

Re: Enhance Smilies Support

Post by warmweer » Tue Nov 26, 2019 9:46 am

EA117 wrote: ↑
Mon Nov 25, 2019 7:06 pm
Enhancement to provide three additional features/changes:

Support for SVG image files.
Support for text replacement in addition to image replacement.
Update default "out of the box" phpBB Smilies configuration to use phpBB's Emoji support.
This ... Yes, not really because I'm all for it, but I can't think of any reason to not extend the "smiley/emoticon" feature.
The year is 2192. The British Prime Minister visits Brussels to ask for an extension of the Brexit deadline. No one remembers where this tradition originated, but every year it attracts many tourists from all over the world.

User avatar
EA117
Registered User
Posts: 1181
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Enhance Smilies Support

Post by EA117 » Tue Nov 26, 2019 12:35 pm

AmigoJack wrote: ↑
Tue Nov 26, 2019 8:33 am
But that's just replacing text with text - it's the same as ":) should/could be replaced with ":-)". This also asks for circular loops when source and target are also defined vice versa.
I'm not clear that the way parsing works actually presents us with this issue, but its certainly a good thing to mention and ensure isn't an issue with any final implementation.

e.g. When you parse a message to replace [foo]widget[/foo] with some long sequence of HTML replacement, the next step isn't "okay, now lets re-parse the HTML replacement to see if that replacement contains any codes we want to replace." The text in the message to be parsed isn't the replacement text. When the message is re-parsed again in the future, it's [foo]widget[/foo] which is being re-parsed, not it's replacement.

So if :stackofsmiles: had a text replacement of ":):):):):)", I expect for ":):):):):)" to be what's rendered as the replacement for where :stackofsmiles: had appeared in the message. Even if :) itself is assigned to "πŸ˜€". No one is going to reparse the message in a way where "the replacement text ':):):):):)' is now considered to be the original author's message text, and should be replaced with 'πŸ˜€πŸ˜€πŸ˜€πŸ˜€πŸ˜€'." The original author's message text being parsed is still :stackofsmiles:.


But I like the idea of "what if there were loops?" Every time your edited the message, your Smilies references would morph from :) to :-) to :-P and back to :) again. Let's break it to work that way & then add it to the feature list. 😜

User avatar
JoshyPHP
Code Contributor
Posts: 1058
Joined: Mon Jul 11, 2011 12:28 am

Re: Enhance Smilies Support

Post by JoshyPHP » Tue Nov 26, 2019 10:47 pm

All of the markup works the same way: input β†’ transformation β†’ output. The process happens exactly once, it's not recursive.

As far as emoticons/smilies are concerned, you can map any string to any HTML. If you want smilies to look like emoji you can simply use the same image. Alternatively, the Emoji plugin supports aliases so that any arbitrary string can be used in place of the Unicode character.
I wrote the thing that does BBCodes in 3.2.

User avatar
EA117
Registered User
Posts: 1181
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: Enhance Smilies Support

Post by EA117 » Tue Nov 26, 2019 11:35 pm

JoshyPHP wrote: ↑
Tue Nov 26, 2019 10:47 pm
All of the markup works the same way: input β†’ transformation β†’ output. The process happens exactly once, it's not recursive.
Thank you, appreciate the confirmation.
JoshyPHP wrote: ↑
Tue Nov 26, 2019 10:47 pm
If you want smilies to look like emoji you can simply use the same image.
Completely agreed. If SVG support alone was made available to Smilies, nothing stops us from just literally pointing a Smiley definition to https://twemoji.maxcdn.com/2/svg/1f61b.svg, or to a local copy of that same SVG.

My intention in spelling out "allow text" is to make it so that if you are intending to use the Emoji images as Smilies (bearing in mind it's also proposed this would be phpBB's default shipping configuration too), the Emojis being displayed for Smilies will automatically follow "whatever improvements are made in phpBB's own Emoji support."

Meaning if phpBB you update the Emoji to pull from Google Noto instead of Twemoji, or update to use some later version or style of Emoji, the Smilies will "simply follow." Because they too are being processed through phpBB's Emoji support, same as Emoji references being made directly in any message text.

As opposed to if the Smilies were defined as literal https://twemoji.maxcdn.com/2/svg/1f61b.svg or local SVG file references, in which case they have to be separately maintained & improved.

Overthinking it, I'm sure. But having the flexibility of "what if I wanted to create :shrug: for Β―\_(ツ)_/Β―" and similar Kaomoji seemed like a useful flexibility that leverages this same capability. So "kill two birds with one stone" as it were.
JoshyPHP wrote: ↑
Tue Nov 26, 2019 10:47 pm
Alternatively, the Emoji plugin supports aliases so that any arbitrary string can be used in place of the Unicode character.
Indeed, and that's definitely one of the benefits I feel like this idea is trying to capitalize on. Not by adding aliases to the textformatter Emoji plug-in, specifically, but "giving the phpBB operator the ability to define shortcodes" for things beyond current Smiley support. Which could be Emoji, but could instead be a sequence of text, or could instead be an image like the current/traditional Smiley support.

Any shortcodes defined in the Smilies appear to take precedence over the Emoji aliases. (e.g. :smile: is defined in both lists, but you end up seeing the Smilies definition as the replacement, not the Emoji alias.) So if Smilies could be enhanced to allow the phpBB operator to define shortcodes for images (as it already does today), or for sequences of non-Emoji text, or for Emoji text --- now Smilies has become their one-stop-shop for where they can define aliases/shortcodes for all of these things on their board.

User avatar
3Di
Former Team Member
Posts: 14487
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

... no Re:

Post by 3Di » Wed Nov 27, 2019 9:44 am

EA117 wrote: ↑
Tue Nov 26, 2019 11:35 pm
Completely agreed. If SVG support alone was made available to Smilies, nothing stops us from just literally pointing a Smiley definition to https://twemoji.maxcdn.com/2/svg/1f61b.svg, or to a local copy of that same SVG.
You can simply point to a local copy of that image using the .png copy of the SVG, those are all available.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity ΒΊ PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
βœ’οΈ Black Friday 2019 @ The Studio β–ͺ️◾️

User avatar
EA117
Registered User
Posts: 1181
Joined: Wed Aug 15, 2018 3:23 am
Contact:

Re: ... no Re:

Post by EA117 » Wed Nov 27, 2019 1:10 pm

3Di wrote: ↑
Wed Nov 27, 2019 9:44 am
You can simply point to a local copy of that image using the .png copy of the SVG, those are all available.
Indeed. But which still raises all the same drawbacks that were mentioned for targeting an SVG, but now without the benefit of being an SVG instead of a pixel-based image.

The enhancement here is not trying to solve the question "How do I make Smilies look like Emoji?" The enhancement here is intending "How do I make Smilies actually be Emoji?"

The point is to enhance phpBB Smilies from the current ":shortcode: will be replaced with an image" mechanism into a ":shortcode: will be replaced with an image, text or Emoji" mechanism.

By leveraging "the actual phpBB Emoji support" during this -- instead of pointing to a fixed local or remote image file, SVG or otherwise -- the enhancement intends to benefit automatically from anything that is fixed in phpBB's Emoji support in the future. e.g. When Twemoji goes offline and must be replaced with something else, any Smilies using Emojis will automatically follow whatever change we make, same as the Emojis used in messages anywhere else in phpBB.

Since if "ten-year-old badly aliased GIFs" are any indication, swapping one set of fixed images for another set of fixed images is just going to repeat the cycle of those images not being maintained. We can make the default phpBB Smilies look good and make them benefit automatically during future updates.

Post Reply

Return to β€œphpBB Ideas”