Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 1 addition & 5 deletions src/Captcha.php
Original file line number Diff line number Diff line change
Expand Up @@ -227,7 +227,6 @@ protected function applyWave($width, $height)
}
}

imagedestroy($this->image);
$this->image = $img2;
}

Expand All @@ -237,7 +236,6 @@ public function output(): void
header('Cache-Control: no-cache, no-store, must-revalidate');
header('Content-Type: image/png');
imagepng($this->image);
imagedestroy($this->image);
}

public function getBase64(): string
Expand All @@ -246,15 +244,13 @@ public function getBase64(): string
ob_start();
imagepng($this->image);
$data = ob_get_clean();
imagedestroy($this->image);
return 'data:image/png;base64,' . base64_encode($data);
}

public function save(string $path): bool
{
if (!isset($this->image)) throw new Exception("Image not created.");
$result = imagepng($this->image, $path);
imagedestroy($this->image);
return $result;
}
}
}