yes, you could write a toolkit module that registers an operation called convert-to-audio/mp3
you'd need some underlying php function or external binary to do the actual conversion..
trowa barton
Joined: 2006-02-23
Posts: 27
Posted: Wed, 2006-04-05 20:45
thanks. is there an existing module that i can use as guide? does the "audio/mp3" in
"convert-to-audio/mp3" have to be a valid mimetype? i've just checked now, the correct mimetype
for mp3 is audio/mpeg.
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Wed, 2006-04-05 21:38
well, the operation name is just a name, but of course you should put the right mime type there.. oops.
try looking at dcraw module
trowa barton
Joined: 2006-02-23
Posts: 27
Posted: Thu, 2006-04-06 17:59
It seems that I an upload of an audio file don't trigger my Toolkit Class. What may be the problem here?
mindless
Joined: 2004-01-04
Posts: 8601
Posted: Thu, 2006-04-06 22:12
You registered the convert-to-audio/mpeg operation?
When uploading a file G2 tries to make a thumbnail for it, so it will look for "thumbnail" or "convert-to-image/jpeg" operations for the uploaded mime type.. there isn't any code to look for the operation you added.
Now that you have a toolkit you need to figure out how to integrate use of that toolkit into the application. Maybe register an ItemAddOption that automatically creates a derivative using your toolkit operation when audio/* items are added.
Posts: 8601
yes, you could write a toolkit module that registers an operation called convert-to-audio/mp3
you'd need some underlying php function or external binary to do the actual conversion..
Posts: 27
thanks. is there an existing module that i can use as guide? does the "audio/mp3" in
"convert-to-audio/mp3" have to be a valid mimetype? i've just checked now, the correct mimetype
for mp3 is audio/mpeg.
Posts: 8601
well, the operation name is just a name, but of course you should put the right mime type there.. oops.
try looking at dcraw module
Posts: 27
It seems that I an upload of an audio file don't trigger my Toolkit Class. What may be the problem here?
Posts: 8601
You registered the convert-to-audio/mpeg operation?
When uploading a file G2 tries to make a thumbnail for it, so it will look for "thumbnail" or "convert-to-image/jpeg" operations for the uploaded mime type.. there isn't any code to look for the operation you added.
Now that you have a toolkit you need to figure out how to integrate use of that toolkit into the application. Maybe register an ItemAddOption that automatically creates a derivative using your toolkit operation when audio/* items are added.