Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/enhancement/2554-prevent-bigger-…
Browse files Browse the repository at this point in the history
…webp' into enhancement/2554-prevent-bigger-webp
  • Loading branch information
CrochetFeve0251 committed Nov 9, 2023
2 parents 7156f88 + 78338a9 commit 6aca18f
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 5 deletions.
2 changes: 1 addition & 1 deletion classes/Optimization/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -530,7 +530,7 @@ public function optimize( $args = [] ) {
return new \WP_Error( 'temp_file_not_found', $temp_file->get_error_message() );
}

if(property_exists($response, 'message' )) {
if ( property_exists( $response, 'message' ) ) {
$args['convert'] = '';
}

Expand Down
7 changes: 3 additions & 4 deletions classes/Optimization/Process/AbstractProcess.php
Original file line number Diff line number Diff line change
Expand Up @@ -657,10 +657,9 @@ public function optimize_size( $size, $optimization_level = null ) {
'optimization_level' => $optimization_level,
] );

if(property_exists( $response, 'message' )) {
if ( property_exists( $response, 'message' ) ) {
$path_is_temp = false;
}

}
}
}
Expand Down Expand Up @@ -736,7 +735,7 @@ protected function compare_webp_file_size( $args ) {
}

// Optimization succeeded.
if (! property_exists( $args['response'], 'message' ) && $args['is_webp'] ) {
if ( ! property_exists( $args['response'], 'message' ) && $args['is_webp'] ) {
/**
* We just created a WebP version:
* Check if it is lighter than the (maybe optimized) non-WebP file.
Expand Down Expand Up @@ -1793,7 +1792,7 @@ public function update_size_optimization_data( $response, $size, $level ) {
*/
$data = (array) apply_filters( "imagify{$_unauthorized}_file_optimization_data", $data, $response, $size, $level, $this->get_data() );

$size = str_replace('@imagify-webp', '', $size);
$size = str_replace( '@imagify-webp', '', $size );

// Store.
$this->get_data()->update_size_optimization_data( $size, $data );
Expand Down

0 comments on commit 6aca18f

Please sign in to comment.