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

Smaller thumbnail trail images #755

Merged
merged 3 commits into from
Oct 30, 2019
Merged

Smaller thumbnail trail images #755

merged 3 commits into from
Oct 30, 2019

Conversation

AWare
Copy link
Contributor

@AWare AWare commented Oct 21, 2019

Part 2 of #658
Replaces #673 which had a rebase accident.

  • Adds a 'thumbs' directory for thumb and large-thumb
  • Changes resizer parameters based on use
  • Puts these new paths into s3 / zips
  • Uses these new paths in the Image path code
  • Uses the use from the backend to choose the image rendered in the card.
  • Picked image sizes based on fractions of full sized images

Performance:
This saves a small amount of RAM, but noticeably decreases image load time on android.

@AWare
Copy link
Contributor Author

AWare commented Oct 21, 2019

The most "compatible" way for this is to make sure trails are downloaded as full and then after a week we release a build that properly uses this.

Copy link
Contributor

@jeanlauliac jeanlauliac left a comment

Choose a reason for hiding this comment

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

That's a lot of changes, so not sure I understand everything. But that seems reasonable. Were you able to check that the old version of the app will still be compatible with new bundles?

projects/Mallard/src/hooks/use-image-paths.ts Show resolved Hide resolved
projects/archiver/src/tasks/zip/helpers/zipper.ts Outdated Show resolved Hide resolved
projects/archiver/src/utils/backend-client.ts Outdated Show resolved Hide resolved
@@ -396,26 +420,27 @@ export const frontPath = (issue: string, frontId: string) =>

// These have issueids in the path, but you'll need to change the archiver if you want to use them.

//To remove.
Copy link
Contributor

Choose a reason for hiding this comment

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

when?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

never, :(
I was planning on moving media to images/${size}/full-size
but instead I just moved all the others to thumbs/${size}/${use}
this means that the image paths don't change for full size images

...props
}: ImageResourceProps) => {
const [width, setWidth] = useState<number | null>(null)
const imagePath = useImagePath(image)
const imagePath = useImagePath(image, 'full-size') //TODO: This should be changed to use once we have a good amount of content published with trail thumbs
Copy link
Contributor

Choose a reason for hiding this comment

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

Can we determine what this is and add a timed trello card for it?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I can make the comment clearer, but I meant the variable use from line 55.

@@ -212,7 +212,7 @@ const OpinionSuper = ({ article, ...tappableProps }: PropTypes) => {
)
}

const SuperHeroImageItem = (props: PropTypes) => {
export const SuperHeroImageItem = (props: PropTypes) => {
Copy link
Contributor

Choose a reason for hiding this comment

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

This change doesnt follow the patterns used in the rest of the code base.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We had this conversation when I started on this PR where we agreed on export const

use: { mobile: 'full-size', tablet: 'thumb' },
}
const article: CAPIArticle = {
key: '🔑',
Copy link
Contributor

Choose a reason for hiding this comment

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

Emojis are nice to look at, but not inline with real data.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is consistent with the other tests in the file.

@@ -63,13 +65,3 @@ export const getImage = async (

return [path, await maybeResponse.buffer()]
}

export const getColours = async (
Copy link
Contributor

Choose a reason for hiding this comment

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

Was this removed on purpose? Seems to not be removed anywhere else.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

It turned out not to be used anywhere, so I got rid of it as it was in the way when making the PR.

@AWare AWare force-pushed the aw-trail-2 branch 2 times, most recently from 5e84b76 to 3776ace Compare October 29, 2019 14:44
@AWare
Copy link
Contributor Author

AWare commented Oct 30, 2019

@jimhunty changes made, can I get the +1 please?

author Alex Ware <alex.ware@guardian.co.uk> 1571648155 +0100
committer Alex Ware <alex.ware@guardian.co.uk> 1572441783 +0000

Smaller thumbnail trail images

don't break thumbs in existing installs or existing content downloaded

archiver fixes

oops

fix lint and test

pr changes

pr comment

fix build

fix test?
@AWare AWare merged commit c07563f into master Oct 30, 2019
@AWare AWare deleted the aw-trail-2 branch October 30, 2019 14:32
@AWare AWare mentioned this pull request Oct 30, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants