Skip to content
This repository has been archived by the owner on Oct 4, 2022. It is now read-only.

Create a TwitterImage component #50

Closed
andizer opened this issue Nov 28, 2018 · 11 comments
Closed

Create a TwitterImage component #50

andizer opened this issue Nov 28, 2018 · 11 comments

Comments

@andizer
Copy link
Contributor

andizer commented Nov 28, 2018

The TwitterImage component will be rendered as an img
yoast___yoast____twitter
Example of the summary with large image card.

_3__twitter

Example of the summary card.

Properties

  • src (full path to the image)
  • type ( summary, summary-large-image)

The type is relevant for the way we display the image. See the specifications below.

When no SRC has been given, we should show a placeholder:
Screen Shot 2019-03-12 at 11 19 49

Specifications

General specs for the image

  • Images must be less than 5MB in size.
  • JPG, PNG, WEBP and GIF formats are supported.
  • Only the first frame of an animated GIF will be used.
  • SVG is not supported.

About the summary with large image, Twitter says:

Images for this Card support an aspect ratio of 2:1 with minimum dimensions of 300x157 or maximum of 4096x4096 pixels.

And for the summary Twitter gives:

Images for this Card support an aspect ratio of 1:1 with minimum dimensions of 144x144 or maximum of 4096x4096 pixels. [...] The image will be cropped to a square on all platforms.

Styling

    background-color: #E1E8ED;

The square will have a width and height of 123.422px. The large image will have a width of 506px and a height of 253px.

Parent #48

@IreneStr IreneStr transferred this issue from another repository Nov 29, 2018
@IreneStr
Copy link
Contributor

IreneStr commented Mar 12, 2019

@luckickken

  1. This is our current Twitter image placeholder:

Schermafbeelding 2019-03-12 om 08 58 51

Could your team provide us with an image that is the same as/closer to Twitter's own placeholder, or should we keep using the current one?

  1. The current Twitter preview does not show errors when there is something wrong with the image, but just unsets the image and shows the default: https://github.com/Yoast/yoast-social-previews/blob/b66215b9f70119de5cc4b6acac4aa7fb5fc33662/js/twitterPreview.js#L444

The Facebook preview does have some error handling:
https://github.com/Yoast/yoast-components/blob/566ae09fc706e90700dcf6605980f3d0e85eaa89/composites/Plugin/SocialPreviews/Facebook/components/FacebookImage.js#L144

https://github.com/Yoast/yoast-components/blob/566ae09fc706e90700dcf6605980f3d0e85eaa89/composites/Plugin/SocialPreviews/Facebook/components/FacebookImage.js#L148

Do we want to add this feedback to the Twitter preview as well? And maybe also some specific feedback about not supported image extensions like SVG etc?

@hedgefield hedgefield self-assigned this Mar 12, 2019
@hedgefield
Copy link

In the design for this I'm experimenting with making the image placeholder area a drop zone, since that is kind of how the facebook one works as well. Does that work for Twitter? I know facebook doesn't show any image if it can't find a suitable one. Does Twitter still show that placeholder after you post a link with no image, or is that just to there to indicate how the template works?

Screen Shot 2019-03-12 at 11 19 49

@IreneStr IreneStr transferred this issue from Yoast/yoast-components Mar 13, 2019
@IreneStr
Copy link
Contributor

@hedgefield Twitter does use the placeholder: Schermafbeelding 2019-03-13 om 10 31 43

@hedgefield
Copy link

Also for the large card?

Well, regardless, I think the placeholder icon is not as important as making it clear that the user should supply an image there, so I recommend following the drop zone design in https://github.com/Yoast/roadmap/issues/21

As for the error, I agree both Facebook and Twitter should display one when there is a problem with the image.

Screen Shot 2019-03-13 at 13 08 04

As for an error about unsupported filetypes, is it even possible to upload an unsupported filetype to the media library?

@IreneStr
Copy link
Contributor

Please note that the above error message is not part of this issue. We'll deal with that in a later stage.

@IreneStr IreneStr added the queue label Mar 22, 2019
@hwinne hwinne added development and removed queue labels Mar 22, 2019
@hwinne hwinne self-assigned this Mar 22, 2019
@johannadevos johannadevos self-assigned this Mar 22, 2019
@hwinne
Copy link
Contributor

hwinne commented Mar 22, 2019

What's the use of background-color: #E1E8ED when this background is only displayed behind the image, and therefore never visible?

@hwinne
Copy link
Contributor

hwinne commented Mar 22, 2019

@johannadevos and I have pushed our work so far. What still needs to be done is:

  • When no src is provided for an image, show the Select image field.
  • Checking whether an image meets the conditions (e.g., is not larger than 5MB).
  • Throwing an error when an image doesn't meet the requirements (e.g., it is too big/small). But that's out of the scope of this issue (@IreneStr).
  • Writing unit tests.

@johannadevos
Copy link
Contributor

As just discussed with @IreneStr, all the checks and the display of their corresponding error messages should be implemented in another issue (she already briefly mentioned this above).

This means that the following part of the issue description is no longer part of the current issue:

Specifications

General specs for the image

  • Images must be less than 5MB in size.
  • JPG, PNG, WEBP and GIF formats are supported.
  • Only the first frame of an animated GIF will be used.
  • SVG is not supported.

About the summary with large image, Twitter says:

Images for this Card support an aspect ratio of 2:1 with minimum dimensions of 300x157 or maximum of 4096x4096 pixels.

And for the summary Twitter gives:

Images for this Card support an aspect ratio of 1:1 with minimum dimensions of 144x144 or maximum of 4096x4096 pixels.

@johannadevos
Copy link
Contributor

johannadevos commented Mar 25, 2019

@andizer You say that "The large image will have a width of 506px and a height of 254px". However, this is not exactly a 2:1 ratio, which should either be 508/254 or 506/253. Where did you get these sizes from, and which size should we use in the end?

EDIT: I will use 506 x 253, because I've found online that this is the size which Twitter uses.

@johannadevos
Copy link
Contributor

In the design for this I'm experimenting with making the image placeholder area a drop zone, since that is kind of how the facebook one works as well. Does that work for Twitter? I know facebook doesn't show any image if it can't find a suitable one. Does Twitter still show that placeholder after you post a link with no image, or is that just to there to indicate how the template works?

Screen Shot 2019-03-12 at 11 19 49

To create this placeholder, for blue and grey I'm using values provided by @hedgefield (#f1f1f1 and #073CBA). They aren't in the standard color palette, but provide more contrast for accessibility.

@afercia
Copy link
Contributor

afercia commented Apr 19, 2019

Closed in #131

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

8 participants