Uploaded emoji images appear to be getting cropped


(PJH) #1

Continuing the discussion from Changing emoji size:

Uploading images that aren’t square seem to get mutilated.

Original:

After upload:


Emojis from animated gif are shown uglily
(Régis Hanol) #2

We automatically resize emojis to make sure they stay small. Might not be the right defaults?

https://github.com/discourse/discourse/blob/master/app/jobs/regular/resize_emoji.rb#L10


(PJH) #3

Can you make a check on the image and only resize if it exceeds (configurable?) limits?

For instance that line is doing the exact opposite of what you intended with my image:

Original: 4.42K
Your ‘optimized’ image: 39.73K

You’ve basically made the image 10 times larger than it was, while breaking what it represents :frowning:


(Régis Hanol) #4

:100:% fail

:walking: -> :door:


(Régis Hanol) #5

Thanks for reporting that @PJH. That issue is now fixed :snowman:

https://github.com/discourse/discourse/commit/82157418eb00c57cc12c123b23f8baa324796745


(Jeff Atwood) #7

I just want to clarify @pjh that only square, emoji sized images are supported here.

If you are putting in banners or other large non-square images… that’s outside of the spec of Emoji.

@zogstrip just to confirm, we should enforce this. Emoji means a very specific thing. If people want to add something outside of that, it should be a plugin.


(Régis Hanol) #8

We’re only inforcing the “square” rule via CSS which can easily be overrided via custom CSS.


(Jeff Atwood) #9

We should be enforcing it on the files as well. Emoji are not irregularly sized… none of them are. They’re square.

http://www.unicode.org/reports/tr51/tr51-1.html#Identification

Current practice is for emoji to have a square aspect ratio, deriving from their origin in Japanese. For interoperability, it is recommended that this practice be continued with current and future emoji.

Non-square “emoji” cannot be allowed.


(Régis Hanol) #11

Just added a new site setting: enforce_square_emoji that is enabled by default.

(oops, seems like my quotes were removed from the commit message :cry:)


#12

I have a similar issue but with square aspect animated gif:
This gif:
http://hub.unitedwestand.fr/uploads/default/_emoji/trollface2.gif
Is shown like this :
http://hub.unitedwestand.fr/uploads/default/_emoji/trollface2.gif?v=0

The gif seems ti be correctly uploaded but not correctly shown with this “?v=0” at the end of the link.

Are animated gif supported as emoji ?


(Régis Hanol) #13