Skip to content

COR-807: Optimize Images #63

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

Merged
merged 4 commits into from
Sep 22, 2017
Merged

Conversation

toastercup
Copy link
Member

@toastercup toastercup commented Sep 20, 2017

Purpose:

This PR (and the cortex PR) utilizes image_optim to accomplish the following:

  • Implements version image optimization
  • Removes version format conversion feature (until this feature seems necessary, thumbnails will be generated using the original file's form)
  • Adds support for SVGs
  • Adds rss image variation, which is now utilized by the RSS feed
  • Upgrades dependencies
  • Implements per-Field image_optim configuration
  • Refactors!

JIRA:

https://cb-content-enablement.atlassian.net/browse/COR-807

Steps to Take On Prod

This will require a migration of the Field configuration, as well as a re-generation of all assets (I'll write a small script that updates each Media with its existing Asset)

Changes:

  • Changes to setup

    • N/A
  • Architectural changes

    • N/A
  • Migrations

    • N/A
  • Library changes

    • cortex-plugins-core
  • Side effects

    • Thumbnails will now be compressed

Screenshots

  • Before
    N/A

  • After
    N/A

QA Links:

http://web.cortex-7.development.c66.me/

How to Verify These Changes

  • Specific pages to visit

    • Media Creation + Media Association in Blogs + RSS Feed
  • Steps to take

    • Ensure Media of any type can be uploaded (PNG, JPG, GIF, SVG, etc)
    • Ensure Media's thumbnail variations are compressed if compression is supported (for example, SVG compression is disabled)
    • Ensure Media's original variation is uncompressed
    • Ensure Media can be associated with an Employer Blog
    • Ensure published Employer Blogs w/ associated Media render the correct data w/ the RSS thumbnail variation: http://web.cortex-7.development.c66.me/rss/v2/employer_blog (note that this has a 1-hour cache
  • Responsive considerations

    • N/A

Relevant PRs/Dependencies:

cortex-cms/cortex#525

Additional Information

N/A

@arelia
Copy link
Contributor

arelia commented Sep 20, 2017

getting server error, will try again later to review:

image

@toastercup
Copy link
Member Author

@arelia looks like it was a weird transient issue - it broke for me once (it timed out), but seems to be working again.

@toastercup
Copy link
Member Author

@arelia I took another look and saw that occasionally, the level of optimization that was going on would lead to timeouts. I've implemented per-Field configuration of image_optim, and setup the Media ContentType with a more sane(+faster) set of optimizers. Good for review again! cc @MKwenhua

@toastercup toastercup force-pushed the topic/COR-807-Optimize-Images branch from 8fde634 to 7a278a2 Compare September 20, 2017 18:36
@arelia
Copy link
Contributor

arelia commented Sep 21, 2017

@toastercup I tried to add the ab logo from Employer (app/assets/images/homepage_logos/ab_logo.svg) and got this error which may or may not be in the scope of this story:

screen shot 2017-09-21 at 10 15 00

@toastercup
Copy link
Member Author

@arelia shrine is detecting this asset as image/svg, while it should (?) be image/svg+xml. I'll have to dig into why this is for this particular file (I've tried other SVGs and it's fine), or figure out how to get mimemagic to spit out both image/svg as well as image/svg+xml as valid MIME types. This is not within the scope of this story - SVG support was just a bonus fix I included.

@arelia
Copy link
Contributor

arelia commented Sep 21, 2017

I was trying to get through adding one of each file type. It times out (shows this same server error from above) with this GIF which is 24mb downloaded: https://giphy.com/gifs/broadcity-comedy-central-season-4-l1J9xF1tfZQ1DqiYM

I'm not trying to review/approve anymore, just making you aware

@toastercup toastercup merged commit c0143d8 into develop Sep 22, 2017
@toastercup toastercup deleted the topic/COR-807-Optimize-Images branch September 22, 2017 16:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants