how can I make a swf appear like an image when uploaded?

5 posts by 2 authors in: Forums > CMS Builder
Last Post: October 23, 2008   (RSS)

By TheSeen - October 16, 2008 - edited: October 16, 2008

Hi all ...

Loving the CMS software. I have been using your products for it must be over 5 years and have to say that CMS is a fantastic leap and very powerful package ... well done.

Anyway, I have added an upload setting in the section editor for the site that I am working on and would like to upload a swf ... but with the swf file embedded and running in the actual website page.

Much like a picture gets added to a page using upload ... but instead it's a swf.

At the moment the content system is treating the swf file as a download link ... so displays nothing but a download text link to the swf file.

You advise is much appreciated.

Adrian

Re: [Dave] how can I make a swf appear like an image when uploaded?

By TheSeen - October 22, 2008

Thanks Dave ... this is working as it should in terms of calling in the specific swf file.

I'm just getting an issue with a Java Run Content script which is needed now whenever using flash files in a website.

I need to be able to pull in the url link or flash name into the Java script code but need to knock off the extension (ie: .swf) form the end. This would then enable the flash file to be embedded into the web page running correctly.

Here is the Java code:

<?php foreach ($roomsRecord['header'] as $upload): ?><script type="text/javascript">
AC_FL_RunContent( 'codebase','http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=9,0,28,0','width','960','height','362','src','<?php echo $upload['urlPath']?>','quality','high','pluginspage','http://www.adobe.com/shockwave/download/download.cgi?P1_Prod_Version=ShockwaveFlash','bgcolor','#181818','movie','<?php echo $upload['urlPath']?>' ); //end AC code
</script>

You can see I have tried including the CMS php 'urlPath' code in the 2 places necessary ... this is working fine and is pulling in the full file link address. I just need to be able to knock off the .swf extension that is being included.

Is this possible?

I would guess that this will be a major point for most users who want to upload and embed swf files through the CMS software as most people will be using the Java Run Content script ... so would be very useful if a fix is identified.

Website is due for launch over the weekend so your quick assistance would be much appreciated.

many thanks
Adrian

Re: [The Seen] how can I make a swf appear like an image when uploaded?

By Dave - October 22, 2008

Hi Adrian,

So all you need is to remove the file extension (.swf) from the end? Here's some code for that:

<?php $upload['urlPathNoExt'] = preg_replace('/\.\w+$/', '', $upload['urlPath']); ?>

Just put that inside the foreach loop but above where you want to use it. Then display it like this:

<?php echo $upload['urlPathNoExt'] ?>

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

Re: [Dave] how can I make a swf appear like an image when uploaded?

By TheSeen - October 23, 2008 - edited: October 23, 2008

Genius David!

Awesome works a treat ... you make it look so simple.
Outstanding software package ... I can see I'll be using this for years to come.

Thanks again for the swift reply.

Kind regards
Adrian