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

avatar aspect ratio #8131

Closed
robert-king opened this issue Oct 30, 2017 · 9 comments · Fixed by #12660
Closed

avatar aspect ratio #8131

robert-king opened this issue Oct 30, 2017 · 9 comments · Fixed by #12660
Assignees
Labels
P4 A relatively minor issue that is not relevant to core functions

Comments

@robert-king
Copy link

robert-king commented Oct 30, 2017

plunkr not working,

but avatars are having their aspect ratios changes (cards and lists):

<img matListAvatar src="..." alt="...">

If my profile pictures aren't square, they get crushed/distorted into a different aspect ratio.

I'm on latest chrome on mac, using material 2.00-beta.12

"dependencies": {
"@angular/animations": "^4.4.5",
"@angular/cdk": "^2.0.0-beta.12",
"@angular/common": "^4.4.5",
"@angular/compiler": "^4.4.5",
"@angular/core": "^4.4.5",
"@angular/forms": "^4.4.5",
"@angular/http": "^4.4.5",
"@angular/material": "^2.0.0-beta.12",
"@angular/platform-browser": "^4.4.5",
"@angular/platform-browser-dynamic": "^4.4.5",
"@angular/router": "^4.4.5",
"@ng-idle/core": "^2.0.0-beta.12",
"@ng-idle/keepalive": "^2.0.0-beta.12",
"angular2-moment": "^1.7.0",
"bootstrap": "^3.3.7",
"core-js": "^2.5.1",
"hammerjs": "^2.0.8",
"jquery": "^3.2.1",
"ng2-signalr": "^2.1.1",
"ngx-bootstrap": "^1.9.3",
"rxjs": "^5.4.3",
"signalr": "^2.2.2",
"zone.js": "^0.8.18"
},
"devDependencies": {
"@angular/cli": "^1.4.7",
"@angular/compiler-cli": "^4.4.5",
"@angular/language-service": "^4.4.5",
"@types/jasmine": "2.5.45",
"@types/node": "^6.0.89",
"codelyzer": "~3.0.1",
"jasmine-core": "^2.8.0",
"jasmine-spec-reporter": "^4.2.1",
"karma": "^1.7.1",
"karma-chrome-launcher": "~2.1.1",
"karma-cli": "~1.0.1",
"karma-coverage-istanbul-reporter": "^1.2.1",
"karma-jasmine": "~1.1.0",
"karma-jasmine-html-reporter": "^0.2.2",
"protractor": "~5.1.2",
"ts-node": "~3.0.4",
"tslint": "~5.3.2",
"typescript": "~2.3.3"
}

@crisbeto crisbeto assigned crisbeto and unassigned crisbeto Oct 30, 2017
@josephperrott
Copy link
Member

The plunker's have been fixed, could you provide a reproduction as I am not quite sure what you are seeing.

@josephperrott josephperrott added the needs: clarification The issue does not contain enough information for the team to determine if it is a real bug label Oct 30, 2017
@robert-king
Copy link
Author

plunker stil doesn't work for me:
https://plnkr.co/edit/rFjyBFVj7UydQ290YGGS?p=preview

e.g. click the edit in plunker button on https://material.angular.io/components/list/overview

@robert-king
Copy link
Author

robert-king commented Dec 16, 2017

Here is an example:


<mat-list role="list">
  <mat-list-item role="listitem">
    <img mat-list-avatar src="https://upload.wikimedia.org/wikipedia/commons/9/93/Denali_National_Park_Polychrome_Mountains_Wide_17350px.jpg" alt="...">
    Item with distorted avatar if not perfectly square.
    </mat-list-item>
</mat-list>

https://stackblitz.com/edit/angular-m4rayy?file=app/list-overview-example.html

@robert-king
Copy link
Author

I guess can use something like:

.example-header-image {
  background-image: url('https://material.angular.io/assets/img/examples/shiba1.jpg');
  background-size: cover;
}

but would be nice if the list-avatar etc had the option to be automatically using cover

@robert-king
Copy link
Author

actually it's quite hard using css background-image: url(..), because to get my images from the server with security, i need to use bearer tokens to get the image (e.g. use auth interceptor), and then I need to turn the blob into a link, sanatize / bypass security, etc etc. I created a pipe which works on [src], would have been quite nice to just use avatar & [src].

@odahcam
Copy link
Contributor

odahcam commented Dec 29, 2017

I think that what ur trying to say is that avatars does not looks good if they're not a square image.

The list-avatar really distorts the image to get some squared picture.

This could be an issue, idk, but is really awful to see that distorted images.

@robert-king
Copy link
Author

yeah, aspect ratio is changed to 1:1, which looks really bad unless you have a square image.

@robert-king
Copy link
Author

i think something that would be useful is a circular image component that displays a circular image thats centered e.g.
<mat-circle-img [src]="..">
and it would have to use background: cover, or do it's own calculations to centre the image.

@jelbourn jelbourn removed the needs: clarification The issue does not contain enough information for the team to determine if it is a real bug label Jan 17, 2018
@josephperrott josephperrott added the P4 A relatively minor issue that is not relevant to core functions label Feb 22, 2018
@crisbeto crisbeto assigned crisbeto and unassigned tinayuangao Aug 13, 2018
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 13, 2018
Improves the scaling for list avatar images that aren't exact squares.

Fixes angular#8131.
crisbeto added a commit to crisbeto/material2 that referenced this issue Aug 14, 2018
Improves the scaling for list avatar images that aren't exact squares.

Fixes angular#8131.
jelbourn pushed a commit that referenced this issue Aug 21, 2018
Improves the scaling for list avatar images that aren't exact squares.

Fixes #8131.
jelbourn pushed a commit that referenced this issue Aug 29, 2018
Improves the scaling for list avatar images that aren't exact squares.

Fixes #8131.
@angular-automatic-lock-bot
Copy link

This issue has been automatically locked due to inactivity.
Please file a new issue if you are encountering a similar or related problem.

Read more about our automatic conversation locking policy.

This action has been performed automatically by a bot.

@angular-automatic-lock-bot angular-automatic-lock-bot bot locked and limited conversation to collaborators Sep 9, 2019
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
P4 A relatively minor issue that is not relevant to core functions
Projects
None yet
Development

Successfully merging a pull request may close this issue.

6 participants