Skip to content

Commit

Permalink
Fix variable type
Browse files Browse the repository at this point in the history
Fix
  • Loading branch information
krekos authored Mar 13, 2020
1 parent 14b9796 commit 92e7e77
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions src/Modifiers/BaseModifiers.php
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,11 @@ public function resize(ModifierParam $param, $width, $height, $flag = Image::FIT
if ($flag) {
$flag = $this->converseFlags(array_slice(func_get_args(), 3));
}

// if is variable string, but '%' sign is missing, then cast it to int
$width = is_string($width) && substr($width, -1) !== '%' ? (int)$width : $width;
$height = is_string($height) && substr($height, -1) !== '%' ? (int)$height : $height;

$image->resize($width, $height, $flag);
}

Expand Down

0 comments on commit 92e7e77

Please sign in to comment.