flownative / flow-image-optimizer

A low level tool for running (image) file optimizations
MIT License
0 stars 5 forks source link

Handling errors during optimize #6

Closed kdambekalns closed 2 years ago

kdambekalns commented 4 years ago

Sometimes the optimize step fails:

Exception in line 156 of /…/Flownative_ImageOptimizer_ImageOptimizerTarget.php: Optimization not successful with exit status -1 and the following output: 

20 Flownative\ImageOptimizer\Service\OptimizerService_Original::optimize(resource, "Detektiv-Freunde-Wettbewerb-2019-573x573.jpg", "optimizedImageCollection", Flownative\ImageOptimizer\Service\OptimizerConfiguration)

Aside from the fact that no output was produced and as such no forther information is available, I suggest to not break publishing in this case.

Affected are https://github.com/flownative/flow-image-optimizer/blob/2f0e833ce59eb9379cb0cb22457f06163043f160/Classes/ImageOptimizerTarget.php#L136 and https://github.com/flownative/flow-image-optimizer/blob/2f0e833ce59eb9379cb0cb22457f06163043f160/Classes/ImageOptimizerTarget.php#L156

While this uses the non-optimized resource, at least some resource is published, which seems better from a user's perspective.

kdambekalns commented 4 years ago

@robertlemke @kitsunet What is your opinion?