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

Optimize and serve chapter/page illustrations #141

Closed
6 tasks done
rviscomi opened this issue Sep 5, 2019 · 42 comments · Fixed by #603
Closed
6 tasks done

Optimize and serve chapter/page illustrations #141

rviscomi opened this issue Sep 5, 2019 · 42 comments · Fixed by #603
Assignees
Labels
development Building the Almanac tech stack good first issue Good for newcomers
Milestone

Comments

@rviscomi
Copy link
Member

rviscomi commented Sep 5, 2019

The raw illustration JPEGs are 2000 by 1000 pixels and up to 7 MB in size.

  • upload raw illustrations
  • figure out which image dimensions we'll actually need
  • generate optimized versions for each size
  • write descriptive alt text for non-visual users
  • write the markup and styles to serve the optimized version depending on the viewport size and capabilities
  • set the chapter illustration to be the default social media cover image

cc @HTTPArchive/developers

@rviscomi rviscomi added the development Building the Almanac tech stack label Sep 5, 2019
@rviscomi rviscomi added this to the Infrastructure complete milestone Sep 5, 2019
@rviscomi
Copy link
Member Author

rviscomi commented Oct 7, 2019

@HTTPArchive/developers is anyone available to work on this?

@logicalphase
Copy link
Contributor

logicalphase commented Oct 7, 2019 via email

@rviscomi
Copy link
Member Author

rviscomi commented Oct 7, 2019

Thanks @HyperPress!

@logicalphase
Copy link
Contributor

Quick update. I got started late on the Mobile Web Chapter review this evening. I still need to finish that up, and I'll take care of the optimizations tomorrow without fail.

@rviscomi
Copy link
Member Author

@HyperPress have you had a chance to look into this? 🙏

@logicalphase
Copy link
Contributor

logicalphase commented Oct 10, 2019 via email

@logicalphase
Copy link
Contributor

@rviscomi is there any particular folder you'd like the optimized versions put? Also, is there guidance on sizing, or will we be using something dynamic for that? Or is this a judgement call?

@rviscomi
Copy link
Member Author

@HyperPress I've merged #196 which creates new subdirectories for each chapter to organize all of their images. All chapters start with hero_xl.jpg which is the full-size hero illustration. All size variations of the illustration should go in these subdirs with relevant suffixes (eg hero_lg, hero_sm).

As for how big each image should be, I think we'll need large and small versions to fit the desktop and mobile layouts. The Chapter page desktop design looks like the illustrations are 866x455 px and the mobile illustrations are ~326x203 px.

Besides simply resizing the illustrations I think we should also try optimizing them for file size, eg by converting to webp. We'll still need jpegs for unsupported browsers, so we should run the resized originals through some kind of jpeg optimizer.

And finally, we'll need to update the chapter page template to include a <picture> element with the various sources.

@logicalphase
Copy link
Contributor

logicalphase commented Oct 12, 2019 via email

@rviscomi
Copy link
Member Author

Hi @HyperPress any updates on this?

@logicalphase
Copy link
Contributor

logicalphase commented Oct 14, 2019 via email

@rviscomi
Copy link
Member Author

Thanks for the update @HyperPress, totally understand and I hope all is well with your daughter and her surgery ❤️

Would it be possible to create a PR with whatever you have so far and we can iterate on it while you're offline?

@logicalphase
Copy link
Contributor

logicalphase commented Oct 14, 2019 via email

@logicalphase
Copy link
Contributor

@rviscomi I'm finished with images up through PWA. I'd like to press on and just work on them til they are done. But if you need them, I can split them and ship what I have. I'd say I'm about an hour away from being totally done.

@rviscomi
Copy link
Member Author

I'd like to press on and just work on them til they are done. But if you need them, I can split them and ship what I have. I'd say I'm about an hour away from being totally done.

Sounds good.

What approach did you end up taking for the different image combos? In terms of size and file format.

@logicalphase
Copy link
Contributor

logicalphase commented Oct 15, 2019

I ran with what you recommended with:
hero_lg.jpg 866w
hero_lg.webp
hero_sm.jpg 326w
hero_sm.webp

and I'm using Squoosh.app for optimization. I left the original in the same folder.

@logicalphase
Copy link
Contributor

logicalphase commented Oct 15, 2019

@rviscomi I forgot to ask, but should this be a PR for master branch, or is there some other? Images are resized and optimized as discussed. I need to update content page paths. If you can let me know on the other I'll get these up to the Github repo. Also, do you want me to optimize the images in the root /static dir as well?

@rviscomi
Copy link
Member Author

Could you make your PR into the design branch? And yes, if you could optimize the other images in /static that would be very helpful! The design branch has the latest images in that directory so make sure to use that one. Thanks again!

@logicalphase
Copy link
Contributor

Okay, I'll close the PR I just opened for master and and correct that.

@rviscomi
Copy link
Member Author

@HyperPress do you have bandwidth to work on writing the markup to serve the appropriate large/small jpg/webp image in the chapter templates? (checklist item 5)

@logicalphase
Copy link
Contributor

logicalphase commented Oct 20, 2019 via email

@rviscomi
Copy link
Member Author

rviscomi commented Nov 2, 2019

Social media image handled by @bazzadp in #302.

@HyperPress would you have time to work on tasks 4 and 5?

@logicalphase
Copy link
Contributor

logicalphase commented Nov 3, 2019 via email

@rviscomi
Copy link
Member Author

rviscomi commented Nov 3, 2019

Thanks @HyperPress!

@logicalphase
Copy link
Contributor

logicalphase commented Nov 4, 2019

Hey @rviscomi - I noticed that the Design branch is no more. Should I commit to Master? Or am I missing something else?

@rviscomi
Copy link
Member Author

rviscomi commented Nov 9, 2019

@HyperPress any update on this?

@logicalphase
Copy link
Contributor

logicalphase commented Nov 9, 2019 via email

@logicalphase
Copy link
Contributor

Hey @rviscomi , Was dropdown.png (which is actually saved as a bitmap) supposed to be a small icon image like 16px x 16px or 24px x 24px in size. It's gigormick and I'm just making sure.

@rviscomi
Copy link
Member Author

rviscomi commented Nov 9, 2019

Yes, it should be a small icon! I see what you mean. WTF?!

@logicalphase
Copy link
Contributor

Somebody was serious about their scale there ;-)

@logicalphase
Copy link
Contributor

I'll have these done this evening. What I'm doing with the images in the root of /images is to optimize the ones that look close to the proper size. The ones that don't I'm creating additional sized versions with the height and/or width in the file name. I'm also creating webp versions of all those.

@rviscomi rviscomi added the ASAP This issue is blocking progress label Nov 10, 2019
@rviscomi
Copy link
Member Author

Only remaining task for this issue is to serve the smaller hero image to mobile viewports.

@logicalphase
Copy link
Contributor

logicalphase commented Nov 10, 2019 via email

@logicalphase
Copy link
Contributor

Hey @rviscomi - I need about another 45 minutes to complete the chapters and I really think I can commit the changers on the hero images for the intro pages, etc. the only thing I changed was the icon image names, and that needs to be only updated in templates base.html and base_chapter.html as far as I can see. Otherwise the image names didn't change for the original optimized images. I just created some made slightly smaller copies of each. I can update those whenever. Anyway. that's where I am right now. Going as fast as I can.

@rviscomi
Copy link
Member Author

Thanks @HyperPress. To confirm, the chapter illustrations are unrelated to any icons and the only change should be to this line, so it's not always hero_lg.jpg:

https://github.com/HTTPArchive/almanac.httparchive.org/blob/master/src/templates/en/2019/chapter.html#L115

@logicalphase
Copy link
Contributor

Right. On this issue #141 I'm updating the hero images with picture element and a large and small for now.

@rviscomi
Copy link
Member Author

Ok great, thank you! Go go go! :)

@logicalphase
Copy link
Contributor

Did the commit with the picture elements and srcset not make it in time for the launch? I just noticed that the changes are not in production.

@tunetheweb
Copy link
Member

Did the commit with the picture elements and srcset not make it in time for the launch? I just noticed that the changes are not in production.

Hey looks like this did indeed get lost! Looks to me like from the conversation it was agreed to resubmit as a separate PR but don't see that coming in. Not sure if there was confusion as to who would do it.

Can you resubmit as a new PR @HyperPress ? Would be nice to get this in since the back is broken on this.

@rviscomi rviscomi removed the ASAP This issue is blocking progress label Nov 26, 2019
@rviscomi rviscomi modified the milestones: SHIP IT!, Après Ski Nov 26, 2019
@rviscomi
Copy link
Member Author

I spoke with @HyperPress on Slack and he's going to stage his changes in a new branch, test, and open a PR. I had started making a PR with his changes from #406 but noticed issues with chapter hero images being too small.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
development Building the Almanac tech stack good first issue Good for newcomers
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants