Closed cjyabraham closed 4 years ago
Done @cjyabraham
PR: https://github.com/LF-Engineering/lfevents/pull/457
We activated and tested the plugin at this environment: https://pr-457-lfeventsci.pantheonsite.io
Nice work! A few comments:
Is that coming from the API so needs to be extended there? This is a good test case for a complex svg.
@dankohn a few questions:
I will work on FAQ sections for the Readme.
Ok, then sounds like the way errors are being handled is good for now. @dankohn are you aware of a timeout of 10s in the API?
This is being addressed on https://github.com/cncf/landscapeapp/issues/511
@rodmeurer Please create a link from the error message indicating an embedded PNG or JPG to https://github.com/cncf/wp-svg-autocrop#why-cant-my-svg-include-a-png-or-jpg. And please create a link to the error message about tspan to https://github.com/cncf/wp-svg-autocrop#why-cant-my-svg-include-text-or-tspan-tags.
Due to the 1pixel border, deploying this is dependent on this issue.
@cjyabraham @dankohn done.
Thanks. I've tweaked a few things to increase the curl timeout and handle another error message: "SVG file embeds a png". There's another issue that I'm tracking with this but I think its cause is upstream.
Waiting to discuss with Megan before I deploy.
As per @dankohn, release plugin on WP directory with this text:
This is a free service but if you will be autocropping more than a thousand SVGs a month, please create your own autocrop server using the code from https://github.com/cncf/svg-autocrop-serverless. If you’re using the service we would appreciate if you would add a link to back to cncf.io as a thank you.
I've submitted the plugin for inclusion in the WP plugin dir.
Plugin now in the WP directory and stored in our github. @rodmeurer let me know if you have a wordpress.org user you'd like me to include in the Contributors section at the bottom.
What's left is for me to activate on the live site.
@cjyabraham you can add this one please https://profiles.wordpress.org/fuerzastudio/
Thank you.
I've added you as a committer and a support rep to the plugin. I'm guessing you have to actually make a commit to the svn repo in order to show up in the "Contributors & Developers" section. Note I have also linked to fuerzastudio in the copy and the plugin is listed as "By fuerzastudio" at the top.
this is now activated on the live site
CNCF has developed SVG Autocrop which optimizes SVG files and trims them to have just a 1 pixel border, among other things. Our editors are in the habit of optimizing every SVG file we upload to LFEvents using SVG Autocrop.
We would like to create a WP plugin which automatically performs this service during upload of SVGs by leveraging the SVG Autocrop API. The plugin will eventually run on cncf.io, the LFEvents sites, and we'd like to release it as a free plugin in the WP plugin directory.
Currently, we use the free Safe SVG plugin which sanitizes the SVG files on upload. The Pro version of the plugin runs the SVGs through an SVGO Optimizer. Both versions offer the ability to hook in our own optimization service using the
wp_handle_upload_prefilter
hook. So we want to build a plugin that has the Safe SVG plugin as a dependency and uses its hook to run the SVG Autocrop operation on every SVG upload.A particularly important feature is propagating errors back to the user. If an SVG includes a PNG or JPEG, autocrop fails with an error. It will also fail if the SVG includes a
text
ortspan
tag, meaning that it is including fonts. Also, please disallow uploads if the autocrop service is down. It is running as a serverless app on Google Cloud Functions, however, so should have good uptime.Develop a Minimum Viable Product for an initial release. From there, we can add on more advanced features.
We will eventually store the code in the CNCF WP SVG Autocrop repo but, for now, just develop it on a branch within the LFEvents repo.