Skip to content

Instantly share code, notes, and snippets.

@pedrokoblitz
Created June 24, 2014 17:09
Show Gist options
  • Save pedrokoblitz/fbf59c3e0f7c67b39dca to your computer and use it in GitHub Desktop.
Save pedrokoblitz/fbf59c3e0f7c67b39dca to your computer and use it in GitHub Desktop.
image manipulation
public function show() {
// Begin capturing the byte stream
ob_start();
// generate the byte stream
imagejpeg($this->image, NULL, 100);
// and finally retrieve the byte stream
$rawImageBytes = ob_get_clean();
echo "<img src='data:image/jpeg;base64," . base64_encode( $rawImageBytes ) . "' />";
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment