spatie/image-optimizer — reverse-engineered prompt
Reverse engineered prompt
Build me a simple PHP package that makes image files smaller by sending them through whatever optimization tools are already installed on the server. It should work with JPG, PNG, GIF, SVG, WEBP, and AVIF files, and it should automatically figure out which system binaries are available and use the right ones for each image type.
I want the basic usage to feel very easy, like creating an optimizer object and calling one method with an image path. By default it should replace the original file with the optimized version, but there should also be an option to save the result to a different output path so the original stays untouched. Please include a way to set a timeout for each optimizer step, sensible defaults for the common tools, and tests plus clear docs on setup and usage. If you need exact command options for the image tools, look up the current docs online.
Want more depth? Deep Reverse