Skip to content

Commit

Permalink
add png support
Browse files Browse the repository at this point in the history
  • Loading branch information
123jjck authored Jun 13, 2021
1 parent 7568dbd commit e4ad80a
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,14 @@ public function render($ava, $type = 'jpeg') {

$canvas = $this->processRender($ava);
ob_start();
imagejpeg ($canvas, null, 100);

if($type == 'jpeg') imagejpeg ($canvas, null, 100);
if($type == 'png' || $type = 'base64') imagepng ($canvas, null, 0);
$image_data = ob_get_contents();
ob_end_clean();
imagedestroy($canvas);

if($type == 'jpeg') {
if($type == 'jpeg' || $type == 'png') {
$image = $image_data;
} else if($type == 'base64') {
$image = base64_encode($image_data);
Expand Down Expand Up @@ -58,3 +60,4 @@ protected function processRender($ava) {
return $canvas;
}
}
?>

0 comments on commit e4ad80a

Please sign in to comment.