Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Allow explicit image sizes #536

Closed
4 of 6 tasks
dclaux opened this issue Aug 8, 2017 · 4 comments
Closed
4 of 6 tasks

Allow explicit image sizes #536

dclaux opened this issue Aug 8, 2017 · 4 comments

Comments

@dclaux
Copy link
Member

dclaux commented Aug 8, 2017

Closed as dupe of #622

Implementation

Problem

Our current image sizing is way too restrictive. We should allow explicit image sizing, allowing card authors to use a large image and render it at the desired size.

Solution

Introduce explicit image capability sizing in all renderers. Exposing this capability via markup can then be done via extensibility.

The HTML renderer will add the following two properties to the Image class:

Property name Type Description
width string (unit) The desired on-screen width of the image, ending in "px"
height string (unit) The desired on-screen height of the image, ending in "px"

The names are chosen so as to not interfere with the existing height property.

When either the pixelWidth or pixelHeight properties (or both) are set, the image is explicitly sized using these values. If only one of the two properties is is set, the other dimension is automatically calculated so that the original aspect ratio of the image is respected.

@dclaux
Copy link
Member Author

dclaux commented Aug 8, 2017

Keep in mind that it is technically already possible to achieve one's desired image size by setting an Image's size to "auto." However it's not possible to use a larger image and render it at a smaller size, unless that size is one of the 3 we support, and will therefore rarely be the one a card author needs. The proposed feature makes it way easier to do icons that will scale properly from 96dpi screens to high dpi screens.

@danmarshall
Copy link
Contributor

We should also consider what this means if we were to support Responsive layouts. I know it's still a "blue sky" idea, but it could be on our roadmap.

@dclaux
Copy link
Member Author

dclaux commented Aug 8, 2017

I think it would actually help - knowing the desired size of an image before loading/rendering it makes it possible to make early layout decisions.

@dclaux dclaux added this to the v1 milestone Aug 8, 2017
@matthidinger matthidinger modified the milestones: v1.1, v1 Aug 11, 2017
@khouzam khouzam removed this from the v1.1 milestone Nov 30, 2017
@khouzam khouzam added the Epic label Apr 5, 2018
@khouzam khouzam added this to the 1804 milestone Apr 5, 2018
@khouzam khouzam modified the milestones: 1804, 1805 Apr 5, 2018
@khouzam khouzam removed this from the 1805 milestone May 25, 2018
@andrewleader
Copy link
Contributor

Closing as dupe of #622

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

No branches or pull requests

5 participants