Uploading flash, mp3 etc.

13 posts by 4 authors in: Forums > CMS Builder
Last Post: October 21, 2008   (RSS)

Re: [einslistir] Uploading flash, mp3 etc.

By Dave - January 20, 2008

Hi einslistir, welcome aboard!

Yes, you can. You can specify which file extensions (and other restrictions) to allow for an upload field in the field editor.

By default CMS Builder would just insert a link to the upload if it's not an image. However, you can also pass the upload url to an inline audio/video player. How do you usually like to link to audio/video in your web pages?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Uploading flash, mp3 etc.

A link to a movie/flash is not what I am looking for. It is important, that the guest is closer to the movie than a link, if you understand me. It is also important, that it is easy for my clients to upload a movie or flash file

Here are links for two pages, I have made, where you can see, how I have done it:
http://www.brekkstein.com/innihald
http://www.jogvanarge.com/pages.php?page=J%F8rundur+(sj%F3nvarpsl%FDsing)

By the way, is there some plans on things like newsletter function and printer-friendly function in CMS Builder?

And what if I do a homepage with CMS builder for a newspaper and they would like to give their customers a code to access the page, so only paying or allowed customers can view the news?

Re: [einslistir] Uploading flash, mp3 etc.

By Dave - January 21, 2008

You bet, we can have it output however you like. What if we have it output the object/embed tag when you upload a wmv in an upload field. Would that work for you?

And for the flash, it looked like the video and the viewer were the same file. We could have it output the flash object tags when you upload a swf.

Would that work? If so I'll post the code for you. If not, let me know exactly how you'd like it to work and we'll make it do that.

>By the way, is there some plans on things like newsletter function and printer-friendly function in CMS Builder?

We do have plans for a newsletter feature, it would probably be an add-on.

Printer friendly pages can be done now, just create another Page Viewer for it and link to it from the regular page viewer.

>And what if I do a homepage with CMS builder for a newspaper and they would like to give their customers a code to access the page, so only paying or allowed customers can view the news?

You could do it two ways, with a regular password protection script that using .htaccess/.htpasswd files. Or with a PHP script by adding some code that required login to the top of the viewer pages.

Hope that helps!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Uploading flash, mp3 etc.

You answer all my questions! And it seems to me, that you also have all the right answers...

Right now I am just looking around and getting eye-openers in CMS Builder here and there, but very soon I guess I will try to get one page to run with it.

But of course I would be very happy to get the code, that make both movies and flash visible right away on the homepage.

Thanks for your outstanding quick replies!

Re: [einslistir] Uploading flash, mp3 etc.

By Dave - January 21, 2008

Ok, let's give this a try. We'll update the code the shows the uploads so if there is a video file it shows the embed code.

First off, I've attached an updated uploadForm_functions.php file. Make sure you're running the latest version (v1.08) and then upload this file to: lib/menus/default/uploadForm_functions.php. There was a bug I discovered while writing this for you where PHP thought the flash swf file was an image and returned an error.

Next, when you generate a page viewer, the regular upload display code looks something like this. I've added some code in red.

<!-- STEP3: Display Uploads from 'uploads2' (Paste this where you want your uploads displayed) -->
<!-- Upload Program Fields : num, createdTime, tableName, fieldName, recordNum, preSaveTempId, filePath, filename, extension, thumbFilePath -->
<!-- Upload Image Fields : isImage, hasThumbnail, urlPath, width, height, thumbUrlPath, thumbWidth, thumbHeight -->
<!-- Upload Info Fields : info1, info2, info3, info4, info5 -->
<?php if ($record): ?>
<?php foreach (getUploads($options['tableName'], 'uploads2', $record['num']) as $upload): ?>
<?php if ($upload['hasThumbnail']): ?>
<img src="<?php echo $upload['thumbUrlPath'] ?>" width="<?php echo $upload['thumbWidth'] ?>" height="<?php echo $upload['thumbHeight'] ?>" /><br/>

<?php elseif ($upload['isImage']): ?>
<img src="<?php echo $upload['urlPath'] ?>" width="<?php echo $upload['width'] ?>" height="<?php echo $upload['height'] ?>" /><br/>

<?php elseif ($upload['extension'] == 'swf'): ?>
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="350" height="220">
<param name="movie" value="<?php echo $upload['urlPath'] ?>">
<param name="quality" value="high">
<embed src="<?php echo $upload['urlPath'] ?>" quality="high"
pluginspage="http://www.macromedia.com/go/getflashplayer"
type="application/x-shockwave-flash" width="350" height="220"></embed>
</object>

<?php elseif ($upload['extension'] == 'wmv'): ?>
<object classid="CLSID:22d6f312-b0f6-11d0-94ab-0080c74c7e95" width="320" height="290">
<param name="FileName" value="<?php echo $upload['urlPath'] ?>">
<param name="AutoStart" value="True">
<param name="ShowControls" value="True">
<param name="ShowStatusBar" value="False">
<param name="ShowDisplay" value="False">
<param name="AutoRewind" value="True">
<embed type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/MediaPlayer/"
autostart="True" filename="<?php echo $upload['urlPath'] ?>"
src="<?php echo $upload['urlPath'] ?>"
width="320" height="290" showcontrols="True" showstatusbar="False" showdisplay="False" autorewind="True">
</embed>
</object>


<?php else: ?>
<a href="<?php echo $upload['urlPath'] ?>">Download <?php echo $upload['filename'] ?></a><br/>

<?php endif ?>
<?php endforeach ?>
<?php endif ?>
<!-- STEP3: /Display Uploads from 'uploads2' -->


Just copy that into your code block that displays uploads. Basically all it does is check to see if the extension is 'swf' or 'wmv' and then outputs the object/embed tags around it if it is.

Hope that helps! Let me know how it works out!
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Uploading flash, mp3 etc.

Dave,

This is great... but what about when a customer asks for playing .flv video files. Have any thoughts on that?

Could I create an FLV player (or find one already created), have it stored on my site, call it and point it the the .FLV file using the $upload['urlPath'] variable as well?

Thank you,

Doug

Re: [dougdrury] Uploading flash, mp3 etc.

By Dave - February 15, 2008

Yes, that's exactly what you could do. Actually, if you can find a good open source one we might even bundle it with CMS Builder. Basically you just check for the .flv extension and output the right code for the player.

Hope that helps, let me know if you need any more details on that.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Uploading flash, mp3 etc.

Great! I will look for one to use. If I get it working, I will let you know which opensource FLV player I used.

Thanks,

Doug

Re: [dougdrury] Uploading flash, mp3 etc.

OK. I got this to work.

I added the following code to the if/elseif stack...

-----------------------------------------------------------------

<?php elseif ($upload['extension'] == 'flv'):
$fileURL=[url "http://$upload['urlPath'"]$upload['urlPath'[/url]];
?>
<OBJECT classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
WIDTH="320" HEIGHT="240" id="myMovieName"><PARAM NAME=movie VALUE="player.swf">
<PARAM NAME=quality VALUE=high><PARAM NAME=bgcolor VALUE=#FFFFFF>
<PARAM NAME=flashvars VALUE=movie=<?=$fileURL?>>
<EMBED src="player.swf?movie=<?=$fileURL?>" quality=high bgcolor=#FFFFFF WIDTH="320" HEIGHT="240"
NAME="myMovieName" ALIGN="" TYPE="application/x-shockwave-flash"
PLUGINSPAGE="http://www.macromedia.com/go/getflashplayer"></EMBED></OBJECT>

<?php else: ?>

-----------------------------------------------------------------------------

I am currently using an opensource player found at http://www.osflv.com/ and it is OK. I will most likely build my own, but needed something to start with. I just googled for the Flash Embed code. It seems a bit old (since it is saying codebase 6,0,40...) but whatever the latest version you have loaded on you machine will run anyways. If someone has the latest embed tags, that would be great!!