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

Optimise already uploaded SVG images #81

Open
1 task done
vikrampm1 opened this issue Oct 20, 2022 · 6 comments
Open
1 task done

Optimise already uploaded SVG images #81

vikrampm1 opened this issue Oct 20, 2022 · 6 comments
Labels
help wanted Extra attention is needed type:enhancement New feature or request.

Comments

@vikrampm1
Copy link

Is your enhancement related to a problem? Please describe.

Optimize existing SVGs when someone triggers a batch regenerate of images, with WP-CLI or a third-party plugin. That way we wouldn't have to build a settings page for that, or a specific mechanism from scratch and the implementation should be quicker.
The challenge with the optimizer is that being a JS tool, it cannot utilize the standard PHP hooks so it would take some testing/investigation to see how this could best work.

For more context refer: #79

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct
@vikrampm1 vikrampm1 added the type:enhancement New feature or request. label Oct 20, 2022
@jeffpaul jeffpaul added the help wanted Extra attention is needed label Oct 20, 2022
@jeffpaul jeffpaul added this to the Future Release milestone Oct 20, 2022
@csloisel
Copy link

I have done a bit of initial investigation here, but I have been unable to find a viable path for leveraging the same SVGO library added in #79 through a WP php hook that is triggered on batch image regeneration.

The only way I could see this working would be a cli command that installs and runs npm packages to the local filesystem. However, this is not a feasible option for most web hosts.

I think the only viable options here would be:
a) Use a different library for batch compression
b) Create a browser interface specific to the plugin that would be able to leverage the same library

@jeffpaul
Copy link
Member

@darylldoyle any thoughts on how to handle this based on the research findings above?

@darylldoyle
Copy link
Collaborator

@jeffpaul unfortunately not. This was initially part of the "pro" package for this reason. It was hard/hacky to do on the server, so I offloaded it to a specific SVGO server I was running to do the compression and then push it back.

Something similar could be done here with the option for people to use their own server? I'm not sure how that sits with the OSP though.

@jeffpaul
Copy link
Member

jeffpaul commented Jan 4, 2023

@csloisel @darylldoyle are there any known, reliable SVGO servers that we could consider integrating with and allow plugin users to select their preference (and potentially include whatever auth credentials are needed for those services via plugin settings)?

@darylldoyle
Copy link
Collaborator

@jeffpaul not that I'm aware of. This is what I was hoping for when I originally made the pro plugin. There's a lack of SVGO services (SVGOAAS?).

I've found the following services that say they support SVG optimisation via API, that could be worth looking into:

The only other option I could see is for 10up to host one, though that'd likely need a larger conversation around what that entails.

@jeffpaul
Copy link
Member

jeffpaul commented May 8, 2023

https://github.com/vector-express/vectorexpress-api#convertor-svgo looks like it might be an option perhaps?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
help wanted Extra attention is needed type:enhancement New feature or request.
Projects
None yet
Development

No branches or pull requests

4 participants