This repository has been archived on 2024-09-05. You can view files and clone it, but cannot push or open issues or pull requests.
shimmie2/contrib/handle_mp3/main.php

46 lines
1.1 KiB
PHP
Raw Normal View History

<?php
2009-08-20 22:37:17 +00:00
/*
* Name: MP3 File Handler
* Author: Shish <webmaster@shishnet.org>
* Description: Handle MP3 files
*/
2009-07-16 19:20:53 +00:00
class MP3FileHandler extends DataHandlerExtension {
protected function create_thumb($hash) {
$ha = substr($hash, 0, 2);
// FIXME: scale image, as not all boards use 192x192
copy("ext/handle_mp3/thumb.jpg", "thumbs/$ha/$hash");
}
2009-07-16 19:20:53 +00:00
protected function supported_ext($ext) {
$exts = array("mp3");
2009-06-05 19:53:00 +00:00
return in_array(strtolower($ext), $exts);
}
2009-07-16 19:20:53 +00:00
protected function create_image_from_data($filename, $metadata) {
global $config;
$image = new Image();
// FIXME: need more flash format specs :|
$image->width = 0;
$image->height = 0;
2009-01-04 19:18:37 +00:00
$image->filesize = $metadata['size'];
$image->hash = $metadata['hash'];
$image->filename = $metadata['filename'];
$image->ext = $metadata['extension'];
2009-01-24 19:05:07 +00:00
$image->tag_array = Tag::explode($metadata['tags']);
$image->source = $metadata['source'];
return $image;
}
2009-07-16 19:20:53 +00:00
protected function check_contents($file) {
// FIXME: mp3 magic header?
return (file_exists($file));
}
}
add_event_listener(new MP3FileHandler());
?>