Skip to content

Commit

Permalink
PNG transparency support
Browse files Browse the repository at this point in the history
  • Loading branch information
zertex committed Oct 12, 2018
1 parent c9233b9 commit 425790e
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,8 @@ TEXTURE_NAME . '-' . COLOR . '.png'

Avater generator extension for Yii2 here: https://github.com/zertex/yii2-avatar-generator

There you can find 2 textures and Play-Bold.ttf font

## Examples

https://zertex.ru/yii2-avatar-generator
5 changes: 4 additions & 1 deletion src/Avatar.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,10 @@ public function get_file_name(): string
if (!file_exists($this->options->images_folder)) {
mkdir($this->options->images_folder, 0777, true);
}
imagepng($this->thumb($this->img, $this->options->width, $this->options->width), $origin);
$thumb = $this->thumb($this->img, $this->options->width, $this->options->width);
imagealphablending($thumb,false);
imagesavealpha($thumb,true);
imagepng($thumb, $origin);
imagedestroy($this->img);
return $this->options->images_url . '/' . $image_file;
}
Expand Down

0 comments on commit 425790e

Please sign in to comment.