Skip to content

Commit

Permalink
Fix int 2
Browse files Browse the repository at this point in the history
  • Loading branch information
zertex committed Feb 18, 2023
1 parent 87a0c79 commit 59721d7
Showing 1 changed file with 16 additions and 16 deletions.
32 changes: 16 additions & 16 deletions src/Avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -210,14 +210,14 @@ private function thumb($img, $width, $height)
$origin_aspect = $origin_width / $origin_height;
$thumb_aspect = $width / $height;

if ( $origin_aspect >= $thumb_aspect ) {
$new_height = $height;
$new_width = $origin_width / ($origin_height / $height);
}
else {
$new_width = $width;
$new_height = $origin_height / ($origin_width / $width);
}
if ( $origin_aspect >= $thumb_aspect ) {
$new_height = $height;
$new_width = intval($origin_width / ($origin_height / $height));
}
else {
$new_width = $width;
$new_height = intval($origin_height / ($origin_width / $width));
}

$virtual = imagecreatetruecolor($width, $height);
imagealphablending($virtual,false);
Expand All @@ -227,14 +227,14 @@ private function thumb($img, $width, $height)

imagealphablending( $img, false );
imagesavealpha( $img, true );
imagecopyresampled($virtual,
$img,
0 - (int) ($new_width - $width) / 2,
0 - (int) ($new_height - $height) / 2,
0, 0,
$new_width, $new_height,
$origin_width, $origin_height);
return $virtual;
imagecopyresampled($virtual,
$img,
0 - intval(($new_width - $width) / 2),
0 - intval(($new_height - $height) / 2),
0, 0,
$new_width, $new_height,
$origin_width, $origin_height);
return $virtual;
}

private function getMainColor($img, $palletSize=[16,8]){ // GET PALLET FROM IMAGE PLAY WITH INPUT PALLET SIZE
Expand Down

0 comments on commit 59721d7

Please sign in to comment.