alphagov / frontend

Serves the homepage, transactions and some index pages on GOV.UK
https://docs.publishing.service.gov.uk/apps/frontend.html
MIT License
35 stars 20 forks source link

Improve homepage promo image workflow #1231

Open alextea opened 7 years ago

alextea commented 7 years ago

Often when homepage promo images are added or changed they are bigger than necessary and this causes performance to suffer.

We should improve the workflow to ensure that developers updating the images are aware of the constraints and images are appropriately resized and compressed.

Some ideas on how to achieve this:

Some things to consider:

mcgoooo commented 7 years ago

https://github.com/toy/image_optim_rails

edwardhorsford commented 7 years ago

Would love to see improvements in this area. I feel like automated tests might be a good start - enough to prod someone to check the image and spend a bit of time optimising them.

mcgoooo commented 7 years ago

the link above makes it part of the asset pipeline, and bar it doing the wrong thing, it's configure and forget

alextea commented 7 years ago

A couple of issues I can see with using the asset_pipeline is that it will be recompressing images, and if it's using lossy compression this could be bad. If the images aren't the right size or are too large it might not be as efficient.

mcgoooo commented 7 years ago

it would be relatively simple to hook into it only when needed i reckon as well, using the base ruby library if we wished more fine grained control.

https://github.com/toy/image_optim

the one linked above is just the fire and forget option, i have used it with good success on previous projects.