Login   Register  
PHP Classes
elePHPant
Icontem

File: example_draw.php

Recommend this page to a friend!
Stumble It! Stumble It! Bookmark in del.icio.us Bookmark in del.icio.us
  Classes of mfboy  >  Create image for WAV file  >  example_draw.php  >  Download  
File: example_draw.php
Role: Example script
Content type: text/plain
Description: example for drawing wave image
Class: Create image for WAV file
Draw a graph of the sound of a WAV file
Author: By
Last change:
Date: 5 years ago
Size: 799 bytes
 

Contents

Class file image Download
<?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

}

?>