Skip to content

Instantly share code, notes, and snippets.

@jeedee
Created July 22, 2010 19:13
Show Gist options
  • Save jeedee/486436 to your computer and use it in GitHub Desktop.
Save jeedee/486436 to your computer and use it in GitHub Desktop.
<?php
ini_set("memory_limit","64M");
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
}
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment