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
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,
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
That's all I can think of right now, though.
interactivetools.com
Re: [Dave] Creating a thumbnail for a Flash (swf) file
Thanks for the reply. That's pretty much what I was expecting.
Kind regards,
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 6, 2009
I'm interested in looking into this further. Can you post your PHP source code for /_home-top-stories2.php?
Chris
Re: [chris] Creating a thumbnail for a Flash (swf) file
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
Just wondering if you were able to find a solution to my Flash thumbnail problem?
Cheers,
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
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!
Chris
Re: [chris] Creating a thumbnail for a Flash (swf) file
Common Sense Design: User-focused Web design
Tel: 001 519 342 5348 | Web: www.commonsensedesign.net