Location: PHPKode > scripts > Create image for WAV file > create-image-for-wav-file/example_draw.php
<?php

if(($file = $_FILES['upload']) && $file['name'] != 'none' && $file['size'] && $file['tmp_name']) {

	include 'class.wave.php';

	$wave = new wave($file['tmp_name']);
	$chunk = $wave->wavechunk();

	if(!is_array($chunk)) {
		exit('This is not a wav file.');
	}

	if($chunk['seconds'] > 999) {

		echo "The wav is too long.\r\n\r\n";
		print_r($chunk);

	} else {

		set_time_limit(999);

		if($im = $wave->waveimage()) {
			header('Content-Type: image/png');
			imagepng($im);
		} else {
			echo "wrong!\r\n\r\n";
			print_r($chunk);
		}

	}

} else {

?>

<form action="?" id="upload_form" method="post" enctype="multipart/form-data">
	<input type="file" name="upload" /><br />
	<button type="submit">Submit Wav file</button>
</form>

<?php

}

?>
Return current item: Create image for WAV file