PluginProbe
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance / trunk
WP-Optimize – Cache, Compress images, Minify & Clean database to boost page speed & performance vtrunk
4.7.0 4.6.1 4.6.0 4.5.5 4.5.4 4.5.3 4.5.2 3.2.20 3.2.21 3.2.22 3.2.3 3.2.5 3.2.6 3.2.7 3.2.9 3.3.0 3.3.1 3.3.2 3.4.0 3.4.1 3.4.2 3.5.0 3.6.0 3.7.0 3.7.1 All 111 releases
← All changes | vendor/rosell-dk/webp-convert/src/Convert/Converters/Ewww.php +7 -3 3.4.2 → trunk View file →
@@ -194,9 +194,10 @@
194 194 // For example, it may return a message such as '{"error":"invalid","t":"exceeded"}
195 195 // Messages has a http content type of ie 'text/html; charset=UTF-8
196 196 // Images has application/octet-stream.
197 197 // So verify that we got an image back.
198 - if (curl_getinfo($ch, CURLINFO_CONTENT_TYPE) != 'application/octet-stream') {
198 + $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
199 + if (($contentType != 'application/octet-stream') && ($contentType != 'image/webp')) {
199 200 //echo curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
200 201 curl_close($ch);
201 202
202 203 /*
@@ -225,8 +226,10 @@
225 226
226 227 throw new ConversionFailedException(
227 228 'ewww api did not return an image. It could be that the key is invalid. Response: '
228 229 . $response
230 + . ". Content type: "
231 + . curl_getinfo($ch, CURLINFO_CONTENT_TYPE)
229 232 );
230 233 }
231 234
232 235 // Not sure this can happen. So just in case
@@ -281,9 +284,10 @@
281 284 $response = curl_exec($ch);
282 285 if (curl_errno($ch)) {
283 286 return 'curl error' . curl_error($ch);
284 287 }
285 - if (curl_getinfo($ch, CURLINFO_CONTENT_TYPE) != 'application/octet-stream') {
288 + $contentType = curl_getinfo($ch, CURLINFO_CONTENT_TYPE);
289 + if (($contentType != 'application/octet-stream') && ($contentType != 'image/webp')) {
286 290 curl_close($ch);
287 291
288 292 /* May return this: {"error":"invalid","t":"exceeded"} */
289 293 $responseObj = json_decode($response);
@@ -342,9 +346,9 @@
342 346 return 'invalid';
343 347 }
344 348 $responseObj = json_decode($response);
345 349 if (isset($responseObj->error)) {
346 - if ($responseObj->error == 'invalid') {
350 + if (($responseObj->error == 'invalid') || ($responseObj->error == 'bye invalid')) {
347 351 return 'invalid';
348 352 } else {
349 353 if ($responseObj->error == 'bye invalid') {
350 354 return 'invalid';