16 posts by 3 authors in: Forums > CMS Builder
Last Post: September 23, 2009   (RSS)

Hi there!

I have a client using the Media icon in a WYSIWYG field to upload Flash movies and they are not displaying. Do I need to add Object code somewhere in the PHP code to get them to display, or somewhere in the page itself (or somewhere in the page template, so it will apply to all future uploaded Flash files). Or maybe I'm missing something very obvious right in the Media button.

Here is a link to the page: http://www.publicmedianet.org/internships.php

and here is the HTML code for the file she's uploaded:
<object data="/cmsAdmin/uploads/InternReel.swf" width="100" height="100" type="application/x-shockwave-flash">
<param name="src" value="/cmsAdmin/uploads/InternReel.swf" />
</object>

I see that the classid and codebase do not automatically populate, but I'd rather the client not have to manually edit code. Let me know if there's something I'm completely missing - thanks so much!
Kelly

Re: [Keltam2] SWF File uploaded through WSYIWYG Media Icon not Displaying

By Dave - September 14, 2009

Hi Kelly,

How would you like it to work? Should the .swf play on it's own, or would you like to add some custom player code around it?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] SWF File uploaded through WSYIWYG Media Icon not Displaying

Hi Guys - Thanks for the quick responses!

Dave - Probably with custom player code. It doesn't need to be 'custom' custom - the skin files that Dreamweaver generates that would probably work across the board for all SWF files. Would putting a < if > statement for SWF type automatically use those files? Is adding a separate Uploads field the only way to do that? Also - would that automatically make all SWF files the same size? (Having an object tag appear with pre-existing width and heights)

Thanks for your help!
Kelly

Re: [Keltam2] SWF File uploaded through WSYIWYG Media Icon not Displaying

By Dave - September 15, 2009

Hi Kelly,

I know a few people have posted about the challenges of adding flash files in the wysiwyg.

If you'd like I could write you a function you could add to your page that would replace the flash code generated by the wysiwyg with whatever other flash code you wanted.

Just post an example of that code that's generated, an example of the code you want it replaced with, and the values you wanted copied over (url, height and width?) and I'll post some example code.

Would that help? Anyone else who would like this or has some input feel free to post as well.

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

Re: [Dave] SWF File uploaded through WSYIWYG Media Icon not Displaying

Hi Dave - Thanks! This would help a ton! Here is the code generated by Dreamweaver when I drop in a Flash Video :

{Clear_Skin_1.swf and FLVPlayer_Progressive.swf are generated files that can be added anywhere (Uploads, Main Directory). Probably the values I'd need replaced are the ones you've listed: the file name, width, and height. Everything else is good as is! I've also posted the code that the WYSIWYG panel generates for SWF files, following the Dreamweaver code}

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
function MM_CheckFlashVersion(reqVerStr,msg){
with(navigator){
var isIE = (appVersion.indexOf("MSIE") != -1 && userAgent.indexOf("Opera") == -1);
var isWin = (appVersion.toLowerCase().indexOf("win") != -1);
if (!isIE || !isWin){
var flashVer = -1;
if (plugins && plugins.length > 0){
var desc = plugins["Shockwave Flash"] ? plugins["Shockwave Flash"].description : "";
desc = plugins["Shockwave Flash 2.0"] ? plugins["Shockwave Flash 2.0"].description : desc;
if (desc == "") flashVer = -1;
else{
var descArr = desc.split(" ");
var tempArrMajor = descArr[2].split(".");
var verMajor = tempArrMajor[0];
var tempArrMinor = (descArr[3] != "") ? descArr[3].split("r") : descArr[4].split("r");
var verMinor = (tempArrMinor[1] > 0) ? tempArrMinor[1] : 0;
flashVer = parseFloat(verMajor + "." + verMinor);
}
}
// WebTV has Flash Player 4 or lower -- too low for video
else if (userAgent.toLowerCase().indexOf("webtv") != -1) flashVer = 4.0; var verArr = reqVerStr.split(",");
var reqVer = parseFloat(verArr[0] + "." + verArr[2]);

if (flashVer < reqVer){
if (confirm(msg))
window.location = "http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash";
}
}
}
}
</script>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>



<body onload="MM_CheckFlashVersion('8,0,0,0','Content on this page requires a newer version of Adobe Flash Player. Do you want to download it now?');">
<script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0','width','360','height','240','id','FLVPlayer','src','FLVPlayer_Progressive','flashvars','&MM_ComponentVersion=1&skinName=Clear_Skin_1&streamName=downloads/FLASH_FILES/InternReel&autoPlay=false&autoRewind=false','quality','high','scale','noscale','name','FLVPlayer','salign','lt','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','movie','FLVPlayer_Progressive' ); //end AC code
</script><noscript><object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0" width="360" height="240" id="FLVPlayer">
<param name="movie" value="FLVPlayer_Progressive.swf" />
<param name="salign" value="lt" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<param name="FlashVars" value="&MM_ComponentVersion=1&skinName=Clear_Skin_1&streamName=downloads/FLASH_FILES/InternReel&autoPlay=false&autoRewind=false" />
<embed src="FLVPlayer_Progressive.swf" flashvars="&MM_ComponentVersion=1&skinName=Clear_Skin_1&streamName=downloads/FLASH_FILES/InternReel&autoPlay=false&autoRewind=false" quality="high" scale="noscale" width="360" height="240" name="FLVPlayer" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" />
</object></noscript>
</body>
</html>

<object data="/cmsAdmin/uploads/InternReel.swf" type="application/x-shockwave-flash" height="100" width="100">
<param name="src" value="/cmsAdmin/uploads/InternReel.swf" />
</object>


Thanks so much for the help! Let me know if there's anything I missed -

Kelly

Re: [Keltam2] SWF File uploaded through WSYIWYG Media Icon not Displaying

By Dave - September 17, 2009

Hi Kelly,

Try adding this to the top of the page inside some <?php ?> tags:

//
function fixFlashObjects($html) {

$match = '<object data="([^"]+)" type="[^"]+" height="(\d*)" width="(\d*)">\s*<param[^>]+>\s*</object>';
// Vars: $1 = filepath, $2 = height, $3 = width
$replace = '
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
width="$3" height="$2">
<param name="movie" value="$1" />
<param name="salign" value="lt" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<embed src="$1" quality="high" scale="noscale" width="360" height="240" salign="LT" type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" />
</object>
';
$html = preg_replace("|$match|s", $replace, $html);

//
return $html;
}


And then adding this to the tag that displays your wysiwyg content:

<?php echo fixFlashObjects( $record['content'] ); ?>

Let me know if that works for you.

Also, if anyone wants to help us figure out all the extensions that might be uploaded through the wysiwyg, and what the code should be replaced with for each, I can code that up and make it automatic for the next version.

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

Re: [Dave] SWF File uploaded through WSYIWYG Media Icon not Displaying

Hi Dave -

Not sure if I'm dropping this in correctly - should I cut and paste everything (including the // 's?)? If I drop everything in as is, I get an "unexpected $end" error (and everything looks commented out in Dreamweaver).

If I remove the //'s, I get a ":" found error. I removed the // Vars: $1 = filepath, $2 = height, $3 = width section, in case that was supposed to be commented out, but now it looks like the file I started with and I'm sure it's because I didn't do it right and took half the code out trying to troubleshoot. =)

Let me know what I'm doing wrong - thank you so much! Here is the link with the original code snippet: http://www.publicmedianet.org/internships2.php
-Kelly

Re: [Keltam2] SWF File uploaded through WSYIWYG Media Icon not Displaying

By Dave - September 17, 2009

Hi Kelly,

Try putting this at the _very_ top, before any other php tags or anything else:

<?php

//
function fixFlashObjects($html) {

$match = '<object data="([^"]+)" type="[^"]+" height="(\d*)" width="(\d*)">\s*<param[^>]+>\s*</object>';
// Vars: $1 = filepath, $2 = height, $3 = width
$replace = '
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000"
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=8,0,0,0"
width="$3" height="$2">
<param name="movie" value="$1" />
<param name="salign" value="lt" />
<param name="quality" value="high" />
<param name="scale" value="noscale" />
<embed src="$1" quality="high" scale="noscale" width="360" height="240" salign="LT" type="application/x-shockwave-flash"
pluginspage="http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash" />
</object>
';
$html = preg_replace("|$match|s", $replace, $html);

//
return $html;
}
?>


If that doesn't work, attach your viewer file to the thread and I'll try adding it for you and attach the updated version.

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

Re: [Dave] SWF File uploaded through WSYIWYG Media Icon not Displaying

Here is the file - I've tried moving it around all over the page. Thanks!
Kelly
Attachments:

internships2.php 28K