Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

We're retiring the forums!

The SilverStripe forums have passed their heyday. They'll stick around, but will be read only. We'd encourage you to get involved in the community via the following channels instead:

DataObjectManager Module /

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, Ed, biapar, Willr, Ingo, swaiba

New Feature: Audio and Video

Go to End

150 Posts   31708 Views


Forum Moderator, 4102 Posts

3 June 2009 at 9:37am

Edited: 03/06/2009 9:38am

New Feature

Thumbnails are now returned as Image objects rather than generated HTML. This means you now have much more control over the way your video thumbnails display. Use the function $VideoThumbnail to get your thumbnail object, then run whatever formatting you want on it. Examples:

<% control MyVideo %>
<img src="$VideoThumbnail.URL" class="my-class" />
<% end_control %>

Thumbnail is now cut during the "processing" phase of the upload. No more template lag! FLV will cut a fairly large thumbnail to give you the most options for resizing. By default the values are 640x480, but if you want to make them bigger, just reset the class vars in your _config.php

FLV::$default_thumbnail_width = 800;
FLV::$default_thumbnail_height = 600;


Shawn Parr

Community Member, 60 Posts

4 June 2009 at 6:23am

"Try it with the latest build, Shawn. Added AAC and AIFF to the list."

I can upload files if they have those extensions (i.e. .aac, .aiff), but the flash player doesn't play them. It is probably a limitation in the flash player. No big deal. Although I should mention that the extension for AAC usually is .m4a, and many programs spit out aiff with .aif

Although I wouldn't spend much time tweaking that since I think the player will still not work anyway... :)

Basically the player loads, then when you click the play icon, it says it is buffering, and the bar fills up. But no audio actually plays. It just sits there. The MP3s load up and play right away (I've got Gigabit between me and the server, no VPN's).

I think most of my users who would be interested in the functionality are going to be totally fine with mp3. I only tested other formats just to know what would happen. Since I can set the allowed type I can make it end user proof.


Community Member, 116 Posts

10 June 2009 at 5:59am

Hi UncleCheese,

What are you using to do video conversion, and grabbing dynamic thumbnails?

Lamin Barrow

Community Member, 22 Posts

10 June 2009 at 6:17am

Edited: 10/06/2009 6:25am

@ DanStephenson.

I think he's using the PHP version of the open-source FFMPEG ( video conversion library to do all of that. Note that to have video and dynamic thumbnail grabbing features available to your site, you must FFMPEG-PHP extension already installed on your dev machine or server.

Hope this helps.


Forum Moderator, 4102 Posts

10 June 2009 at 6:54am

No, it's not the PHP extension. That isn't full-featured, as it turns out. I'm using the Linux package. You can just yum it down. Super easy install.

Most users of the video features have just asked their sys admin to install it and haven't had any problems, other than setting FLV::set_ffmpeg_root('/usr/bin... etc') to properly configure it.

Some hosts come with it pre-installed, like Site5. You can test whether you have FFMPEG installed on your server by putting:


in your _config.php.

Lamin Barrow

Community Member, 22 Posts

10 June 2009 at 7:01am


Thanx for the clarifications. (o:)


Community Member, 148 Posts

10 June 2009 at 11:28am

Hi, I'm having the same problem as others in this thread.....I'm getting the following error "Method 'forTemplate' not found in class 'File'"

code as follows:

class Resource extends DataObject
	static $db = array (
		'Name' => 'Text',
		'Description' => 'Text'
	static $has_one = array (
		'Attachment' => 'File',
		'Page' => 'Page'
	public function getCMSFields_forPopup()
		return new FieldSet(
			new TextField('Name','Name'),
			new TextareaField('Description','Description'),
			new FileIFrameField('Attachment','Attachment')


class Page extends SiteTree {
	public static $db = array(	);	
	public static $has_one = array();	
	static $has_many = array ('Resources' => 'Resource');
	public function getCMSFields()
		$f = parent::getCMSFields();
		//setup resources tab
		$manager = new FileDataObjectManager(
				'Name' => 'Name', 
				'Description' => 'Description' 
		$manager->setBrowseButtonText("Upload File"); 		
		$f->addFieldToTab("Root.Content.ResourceFiles", $manager);
		return $f;

If I upload flv's it works fine, but if I upload pdfs or docs it breaks. Any ideas?


Forum Moderator, 4102 Posts

10 June 2009 at 2:02pm

PDFs and DOCs don't have a forTemplate method because they fall in to the generic File class. You're going to have to sniff out on your template whether the file is and FLV/MP3 or not. FileDataObjectManager detects the FLV or MP3 extension and "upgrades" those files to the FLV or MP3 class, which have their own forTemplate methods that render Flash players.

Standard file objects don't have a forTemplate method, though, so you'll have to do something like a link to $File.URL or however you want to handle it.

Go to Top