Creating a thumbnail for a Flash (swf) file

8 posts by 3 authors in: Forums > CMS Builder
Last Post: August 13, 2009   (RSS)

By NigelGordijk - August 5, 2009 - edited: August 5, 2009

Hi, All.

I'm trying to create an article index page that checks to see if either a static image file or a swf file has been uploaded, then displays a thumbnail alongside the relevant text. The swf files are added using a wysiwyg field.

http://www.yallaf1.com/_home-top-stories2.php

As far as I'm aware, CMSB can't rescale an swf file, so does anyone have a suggestion for how best to accomplish this effect?

Many thanks,
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Creating a thumbnail for a Flash (swf) file

By Dave - August 5, 2009

Yea we don't have anything to create swf thumbnails. If they were uploaded through an upload field you could detect the extension and show a default "play" graphic or something like that that linked to them. There's a post on doing that with PDFs here: http://www.interactivetools.com/forum/gforum.cgi?post=73438#73438

That's all I can think of right now, though.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Creating a thumbnail for a Flash (swf) file

By NigelGordijk - August 6, 2009

Hi, Dave.

Thanks for the reply. That's pretty much what I was expecting.

Kind regards,
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [chris] Creating a thumbnail for a Flash (swf) file

By NigelGordijk - August 6, 2009

Here you go, Chris (attached).
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net
Attachments:

_home-top-stories2.php 10K

Re: [chris] Creating a thumbnail for a Flash (swf) file

By NigelGordijk - August 13, 2009

Hi, Chris.

Just wondering if you were able to find a solution to my Flash thumbnail problem?

Cheers,
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net

Re: [NigelGordijk] Creating a thumbnail for a Flash (swf) file

By Chris - August 13, 2009

Hi NigelGordijk,

Sorry it's taken me so long to get back to you on this. I was chasing a red herring. :)

HTML can rescale a flash file, but not thumbnail one.

It seems the way you're currently uploading flash files is into a "wysiwyg" field called "wysiwyg_upload". If you upload your flash files instead into an "upload" field, you can programmatically control their layout.

In your viewer code, you can test to see if a file has been uploaded into an upload field for a record (and whether it's flash or an image,) then display it with a size suitable for that page. The following code makes sure that there is at least one uploaded file in the 'upload' field (and displays nothing if there's not), then deals explicitly with the first one:

<?php if (sizeof($record['upload']) > 0): ?>
<?php if (!strcasecmp($record['upload'][0]['extension'], 'swf')): ?>
<object height="100" width="100" data="<?php echo $record['upload'][0]['urlPath'] ?>" type="application/x-shockwave-flash">
<param name="src" value="<?php echo $record['upload'][0]['urlPath'] ?>" />
</object>
<?php else: ?>
<img height="100" width="100" src="<?php echo $record['upload'][0]['urlPath'] ?>">
<?php endif; ?>
<?php endif; ?>


Another viewer could specify different height and width values. If the height and width you're using match the height and width you've specified for image thumbnails, you can use "thumbUrlPath" in place of "urlPath" for the <img> tag for faster-loading, nicer-looking pages.

I hope this helps you along!

By the way, you've got a really great-looking site!
All the best,
Chris

Re: [chris] Creating a thumbnail for a Flash (swf) file

By NigelGordijk - August 13, 2009

Thanks for looking into this, Chris. Much appreciated!
Nigel Gordijk

Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net