Recent Topics

1 Mar 26, 2006 23:32    

Hello, some background. I am a profoundly deaf blogger. I make blogs using video with sign language - for examples you can take a look at my blog's video section - http://gwallgofi.com/videos.php

All posts are done using the YouTube plugin, excellent tool. Hats off for that. However I would like the ability to post my own movies quickly without the delay that YouTube give - I might have to wait more than an hour etc before a movie I make is approved before I can finally show it on my blog using YouTube plugin.

When you blog (certianly in my case) I just wanna a post and post it and be done with it. Plus I'll like to have my own movies on my blog rather than via YouTube (as additional compression of converting a movie into Flash for YouTube can degrade the video quality and when I am signing, video quality is very important.

Furthermore I'm with Dreamhost - which give me 1TB of bandwidth monthly, with 8GB added every week, so bandwidth is no longer an issue for me :D

Anyway there is really no easy way for me to be able to post a movie on my blog. So I took a look at the YouTube plugin and I copied some code from there and this is what I have:


<?php

if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );


class movie_plugin extends Plugin

{

	var $name = 'Movie plugin';
	var $code = 'movieplugin';
	var $priority = 10;
	var $version = '0.1';
	var $author = 'JGJones';
	var $help_url = '';

	var $is_tool = true;
	var $apply_when = 'opt-out';
	var $apply_to_html = true;
	var $apply_to_xml = true;

	function movie_plugin()
	{
		$this->short_desc = T_('EmbeddedMovie plugin');
		$this->long_desc = T_('Insert videos into posts.');
	}


	var $search = array( '#\[vid](.+?)\[/vid]#is' );
	var $replace = array('<div style="text-align:center"><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="320" height="260"><param name="src" value="$1" /><param name="controller" value="true" /><object type="video/quicktime" data="$1" width="320" height="260" class="mov"><param name="controller" value="true" /> Error text. </object></object></div>');



	function Render( & $params )
	
	{
		if( ! parent::Render( $params ) )
		{	// We cannot render the required format
			return false;
		}

		$content = & $params['data'];

		$content = preg_replace( $this->search, $this->replace, $content );

		return true;
	}

}
?>

With the idea that I could use YouTube's [YouTube]code[/YouTube] style and use a [vid]link to video[/vid] so I could easily post links without the _formating.php kicking a fuss about invalid object tags etc.

Now I know basically sod all about php so I have no idea if the above will work and I'm hoping the post above is just a start to get someone helping out :) Will it work? If not, what can be done to make it work?

The dream natually is for FileManager to easily allow movies be implemented into posts just like with images but in the meantime...

Cheers and I appericate any help!

JGJones
http://gwallgofi.com[/code]

2 Mar 27, 2006 18:10

Hello. I made the YouTube plugin and it looks like your code snippet will work the same way, using a renderer to bypass the html validator. That should work fine. Of course, that type of plugin requires you to be using at least version 1.6, but I'm guessing that you already know that since you're using the file manager, too. Have you tried your code yet? Does it work?

3 Mar 27, 2006 20:09

Sheepking,...I have tried the code..but didn't work
maybe other can help with that.
It would be great and useful i think

4 Mar 28, 2006 18:08

Sorry Yosemirza...here's the full code. I only include the bits that does something. It's basically copied from the youtube plugin code, but changed to fit quicktime movies rather than flash :)

Since this plugin only works for Quicktime movies, if I have it right it will do [qt]link to movie[/qt] in a post and it render in page.

BTW bear in mind that my knowledge of php is about 0.01% of the youtube plugin author so don't trust your blog on it :D


<?php

if( !defined('EVO_MAIN_INIT') ) die( 'Please, do not access this page directly.' );

class movie_plugin extends Plugin

{
	var $name = 'movie_plugin';
	var $code = 'movie';
	var $priority = 10;
	var $version = '0.1';
	var $author = 'JGJones';
	var $help_url = 'http://gwallgofi.com';

	var $is_tool = true;
	var $apply_when = 'opt-out';
	var $apply_to_html = true;
	var $apply_to_xml = true;
	 
	function movie_plugin()
	{
		$this->short_desc = T_('movie_plugin');
		$this->long_desc = T_('Insert videos into posts.');
	}

// with thanks to code borrowed from YouTube plugin. 
// This will work only for Quicktime movies

	var $search = array( '#\[vid](.+?)\[/vid]#is' );
	var $replace = array('<div style="text-align:center"><object classid="clsid:02BF25D5-8C17-4B23-BC80-D3488ABDDC6B" codebase="http://www.apple.com/qtactivex/qtplugin.cab" width="320" height="260"><param name="src" value="$1" /><param name="controller" value="true" /><object type="video/quicktime" data="$1" width="320" height="260" class="mov"><param name="controller" value="true" /> Error text. </object></object></div>');

	function AdminEndHtmlHead( & $params )
	{}

	function AdminAfterPageFooter( & $params )
	{}

	function DisplayToolbar( & $params )
	{}

	function DisplayEditorButton( & $params )
	{}

	function Render( & $params )
	
	{
		if( ! parent::Render( $params ) )
		{	// We cannot render the required format
			return false;
		}

		$content = & $params['data'];

		$content = preg_replace( $this->search, $this->replace, $content );

		return true;
	}

}
?>

put that code into a file, name as movie.plugin.php and place in plugin folder. Cheers

5 Mar 28, 2006 18:18

ok it won't kill your blog - that's something :)

I have a movie link wrapped with [qt] [/qt] but sadly does not work. Post shows the [qt]link[/qt]. hmm what am I doing wrong here? Hope some extremely nice chap helps out here? I'll even tell my mum that you're super nice and to knit you a woolly hat?...well she can't knit...

6 Mar 29, 2006 18:56

Thanks...I will try again...
before i just turned off my html checker to post movie
I am not good in Php or something like that.
your plugin will work...
Do you want to see my web? It's in Minangkabau Language ( A Nice Place in West Sumatra, Indonesia ) but not all, I haven't finished to translate yet...

www.andalas.biz


Form is loading...