Skip to content

Commit

Permalink
Gaussholder_Image_Editor_Imagick code optimization
Browse files Browse the repository at this point in the history
  • Loading branch information
vralle committed Dec 7, 2019
1 parent ff3ee7e commit e9f16a4
Showing 1 changed file with 6 additions and 4 deletions.
10 changes: 6 additions & 4 deletions includes/class-gaussholder-image-editor-imagick.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,11 +21,11 @@ class Gaussholder_Image_Editor_Imagick extends WP_Image_Editor_Imagick {
/**
* Generate LQIP Parts
*
* @param int $sample_factor [description].
* @param int $sample_factor Scaling factor.
* @return mixed Preview image parts or null.
*/
public function create_lqip( $sample_factor ) {
$lqip_part = '';
$lqip_part = null;
try {
$width = floor( $this->size['width'] / $sample_factor );
$height = floor( $this->size['height'] / $sample_factor );
Expand All @@ -44,9 +44,11 @@ public function create_lqip( $sample_factor ) {
} catch ( Exception $e ) {
new WP_Error( 'create_lqip_error', $e->getMessage(), $this->file );
}

if ( $lqip_part ) {
return base64_encode( $lqip_part ) . ',' . $width . ',' . $height;
$lqip_part = base64_encode( $lqip_part ) . ',' . $width . ',' . $height;
}
return null;

return $lqip_part;
}
}

0 comments on commit e9f16a4

Please sign in to comment.