I wrote a small add-on prefilter module to transform the embedded objects generated by the tinymce editor into swf tools codes for presentation via the swf tools filter. This allows editors to use the simple interface to upload and place media, while still controlling presentation via the standard swf tools settings.

swftools_prefilter.info

; $Id$
name = SWF Tools Prefilter
description = Transforms Tiny MCE embedded objects into SWF Tools codes
version = "6.x-1.0"
core = 6.x
project = "swftools_prefilter"
package = SWF Tools

swftools_prefilter.module

/**

  SWF Tools Prefilter is a small helper module for use with WYSIWYG editors
  such as Tiny MCE which allow uploading and embedding multimedia files as
  embedded objects.  
 
  Sample input (produced by tinymce):

    <object classid="clsid:02bf25d5-8c17-4b23-bc80-d3488abddc6b" width="100" height="100" codebase="http://www.apple.com/qtactivex/qtplugin.cab#version=6,0,2,0"><param name="src" value="http://mysite.com/sites/mysites.com/libraries/tinymce/examples/media/sample.mov" /><embed type="video/quicktime" width="100" height="100" src="http://mysite.com/sites/mysites.com/libraries/tinymce/examples/media/sample.mov"></embed></object>

  Sample output:

    [swf file="http://mysites.com/sites/mysites.com/libraries/tinymce/examples/media/sample.mov"]

  The media will then be presented by SWF Tools using the SWF Tools input
  filter.  To use this, enable this module, then browse to Admin > Settings >
  Filters and configure all necessary input formats to add the SWF Tools
  Prefilter filter.  Make sure to rearrange the filters for each input format
  so that this prefilter runs before the usual SWF Tools filter.

  Author: mvc (http://drupal.org/user/15016)
  Sponsor: Open Learning Exchange (http://ole.org/)

 */

/**
 * Implementation of hook_prefilter_tips()
 */
function swftools_prefilter_filter_tips($delta, $format, $long = false) {
  if ($long) {
    return t('Multimedia objects embedded via the WYSIWYG editor will be displayed using SWF Tools.');
  }
  else {
    return t('Multimedia objects embedded via the WYSIWYG editor will be displayed using SWF Tools.');
  }
}

/**
 * Implementation of hook_filter()
 */
function swftools_prefilter_filter($op, $delta = 0, $format = -1, $text = '') {
  switch ($op) {
    case 'list':
      return array(0 => t('SWF Tools prefilter'));

    case 'no cache':
      // No caching
      return $delta == 0;

    case 'description':
      return t('Transform Tiny MCE embedded multimedia objects into SWF Tools codes to be displayed via SWF Tools filter.');

    case 'prepare':
      // nothing to do
      return $text;

    case 'process':
      $text = preg_replace('@<object.*?<param name="src" value="([^"]+)".*?</object>@s', '[swf file="$1"]', $text);
      return $text;

    default:
      return $text;
  }
}

Comments

mvc’s picture

Note: for now this ignores params such as size but it wouldn't be difficult to add that.

Ollie222’s picture

This looks to be a decent clever way of altering the behaviour of the tinymce media plugin.

With the addition of a few extra features such as parsing dimensions it could be very useful.

lilyan’s picture

Higosoft SWF to MOV Converter is the greatest software to transform SWF to MOV for those who wish to upload videos online. Its multi-purpose and friendly interface allow it to be simple to create MOV files rapidly.

AngelinaAdelaide’s picture

I use a swf to mov for mac converter. it is easy to use, and fast, you can have a try