Skip to content

Instantly share code, notes, and snippets.

@stmllr
Last active August 29, 2015 13:56
Show Gist options
  • Save stmllr/8825791 to your computer and use it in GitHub Desktop.
Save stmllr/8825791 to your computer and use it in GitHub Desktop.
<?php
/** Writing png image to file */
$filename = vfsStream::url('root/test.png');
// not testable with vfsStream
imagepng($image, $filename);
// Workaround, testable with vfsStream
ob_start();
imagepng($image);
$imageRawData = ob_get_contents();
ob_end_clean();
file_put_contents($filename, $imageRawData);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment