Skip to content

feat(docs-infra): add profile picture size check - #41253

Closed
AndrewKushnir wants to merge 2 commits into
angular:masterfrom
AndrewKushnir:check-picture-size
Closed

AndrewKushnir wants to merge 2 commits into
angular:masterfrom
AndrewKushnir:check-picture-size

Conversation

@AndrewKushnir

Copy link
Copy Markdown
Contributor

This commit updates the logic that validates contributors.json data and introduces a new check that verifies that profile images don't exceed specified limit.

PR Type

What kind of change does this PR introduce?

  • angular.io application / infrastructure changes

Does this PR introduce a breaking change?

  • Yes
  • No

@AndrewKushnir AndrewKushnir added action: review The PR is still awaiting reviews from at least one requested reviewer comp: docs-infra target: patch This PR is targeted for the next patch release labels Mar 17, 2021
@AndrewKushnir
AndrewKushnir requested a review from gkalpak March 17, 2021 23:17
@ngbot ngbot Bot modified the milestone: Backlog Mar 17, 2021
@google-cla google-cla Bot added the cla: yes label Mar 17, 2021
@AndrewKushnir

Copy link
Copy Markdown
Contributor Author

@gkalpak I've created this PR as a followup after reviewing PR #41204. There is a couple questions that I need your input on:

  • I've used 50kb as a limit as 90th percentile based on file sizes that we have now.
  • There are 12 files that exceed that limit, thus the check will fail, but I think we should not increase the limit more (I'd actually consider to make it lower, may be somewhere between 20-30kb). We can hardcode those image paths in an exception list, but I was thinking if we can come up with a file name pattern that would indicate that the file size should not be checked (something like starting a filename with _, for ex. _andrew-kushnir.jpg).

Please let me know what do you think.

@AndrewKushnir AndrewKushnir changed the title docs-infra: add profile picture size check feat(docs-infra): add profile picture size check Mar 17, 2021
@petebacondarwin

Copy link
Copy Markdown
Contributor

How about we just reduce the size of these 12 files?

@gkalpak

gkalpak commented Mar 18, 2021 •

Copy link
Copy Markdown
Member

Wow, I didn't realize we have such large image files in there 🤯
We should definitely try to impose a smaller limit.

@StephenFluin has been trying to keep images under 20kb (#28437 (comment), #32518 (review), #33516 (comment)), but apparently some larger ones have slipped in lately 😱

Given that these images are only displayed as 168px x 168px, it doesn't make sense to have large images there. (Keep in mind that all these images are downloaded and stored in the cache for all users via the SW, so it makes a lot of sense to try to keep them at reasonable sizes. EDIT: To clarify, these images are part of the docs-lazy asset group, so they are only cached if the user visits the /about page.)

I would think that a 30kb limit is enough. For the existing images that exceed that limit (currently 26), I think it would be preferable to add them to an exception list and over time try to get them below the limit (e.g. we could ping the "owners" or even reduce the sizes ourselves).

(We could even go as far as using image-size to detect the image dimensions and enforce limits there as well. We use that for a different purpose in a dgeni service.)

This commit updates the logic that validates contributors.json data and introduces a new check that verifies that profile images don't exceed specified limit.
@AndrewKushnir
AndrewKushnir marked this pull request as ready for review March 18, 2021 19:34
@AndrewKushnir

Copy link
Copy Markdown
Contributor Author

Thanks for the comments @gkalpak and @petebacondarwin 👍

I've added a blocklist for now and reduced the limit to 30kb and George proposed.
We can do a cleanup/resize as a separate pass and for now prevent new large images from being added.

Could you please take another look at the changes when you get a chance?

Thank you.

@petebacondarwin

Copy link
Copy Markdown
Contributor

Why not just reduce the image size right now? It seems like a lot more work to have to add and then remove the blocklist later.

@gkalpak gkalpak left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thx, @AndrewKushnir!

Reducing the image sizes would be great of course, but I wouldn't block the PR on that.

@AndrewKushnir AndrewKushnir added action: merge The PR is ready for merge by the caretaker and removed action: review The PR is still awaiting reviews from at least one requested reviewer labels Mar 18, 2021
mhevery pushed a commit that referenced this pull request Mar 19, 2021
This commit updates the logic that validates contributors.json data and introduces a new check that verifies that profile images don't exceed specified limit.

PR Close #41253
@mhevery mhevery closed this in 2ccb579 Mar 19, 2021
@gkalpak

gkalpak commented Mar 19, 2021

Copy link
Copy Markdown
Member

FYI, I have created #41287 to track reducing the image sizes.

petebacondarwin added a commit to petebacondarwin/angular that referenced this pull request Mar 21, 2021
In angular#41253 the size of contributor images was limited, but
some images were already too large. So an exclusion list
was added. These images have now been reduced, so
the exclusion list is no longer needed.

The files were reduced by a combination of running them through the
https://tinyjpg.com/ online service and manually setting their size to
168px wide or tall using the MacOS Image Preview app.
mhevery pushed a commit that referenced this pull request Mar 22, 2021
In #41253 the size of contributor images was limited, but
some images were already too large. So an exclusion list
was added. These images have now been reduced, so
the exclusion list is no longer needed.

The files were reduced by a combination of running them through the
https://tinyjpg.com/ online service and manually setting their size to
168px wide or tall using the MacOS Image Preview app.

PR Close #41292
mhevery pushed a commit that referenced this pull request Mar 22, 2021
In #41253 the size of contributor images was limited, but
some images were already too large. So an exclusion list
was added. These images have now been reduced, so
the exclusion list is no longer needed.

The files were reduced by a combination of running them through the
https://tinyjpg.com/ online service and manually setting their size to
168px wide or tall using the MacOS Image Preview app.

PR Close #41292
TeriGlover pushed a commit to TeriGlover/angular that referenced this pull request Apr 5, 2021
This commit updates the logic that validates contributors.json data and introduces a new check that verifies that profile images don't exceed specified limit.

PR Close angular#41253
TeriGlover pushed a commit to TeriGlover/angular that referenced this pull request Apr 5, 2021
In angular#41253 the size of contributor images was limited, but
some images were already too large. So an exclusion list
was added. These images have now been reduced, so
the exclusion list is no longer needed.

The files were reduced by a combination of running them through the
https://tinyjpg.com/ online service and manually setting their size to
168px wide or tall using the MacOS Image Preview app.

PR Close angular#41292
@angular-automatic-lock-bot

Copy link
Copy Markdown

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 Apr 19, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

action: merge The PR is ready for merge by the caretaker cla: yes target: patch This PR is targeted for the next patch release

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants