Tycoon Talk
Become a Big fish!
The number 1 forum for online business!
Post topics, ask questions, share your knowledge.
Tycoon Talk is part of Freelancer.com - find skilled workers online at a fraction of the cost.

PHP Forum


You are currently viewing our PHP Forum as a guest. Please register to participate.
Login



Freelance Jobs

Reply
Rotating SWF Files...
Old 10-28-2006, 10:52 PM Rotating SWF Files...
Banned

Posts: 61
Name: Oh, don't go there
Location: United States
Trades: 0
I am using a program called Amara Flash Slideshow builder to create swf files out of simple jpg images...Now what I am trying to do is simply rotate the swf files on a 24 hour basis, NOT on every page reload...How can this be done? Could you post a php or cgi script that does this? Thank you everyone!
Frostydasnowman is offline
Reply With Quote
View Public Profile Visit Frostydasnowman's homepage!
 
 
Register now for full access!
Old 10-29-2006, 07:26 PM Re: Rotating SWF Files...
mgraphic's Avatar
Truth Seeker

Latest Blog Post:
JAMISONTUNES
Posts: 2,918
Name: Keith Marshall
Location: Connecticut
Trades: 0
OK - I've noticed multiple posts asking for help on this, so I came up with a function that will auto select a swf file from a directory accoring to the day. There might be a few bugs in there and might select one out of order once in a while, but all-in-all, it should work.

Also it will change when you add or remove files in the directory.

The PHP Function:
PHP Code:
<?php
  
  
function swf_rotator () {
    
    
// Relative path to swf files (i.e. ./swf/) with trailing slash
    
$swf_path './swf/';
    
    
$file_array = Array();
    if (
$s_dir = @dir($swf_path)) {
      
      while (
$s_file $s_dir->read()) {
        
        if (
strstr($s_file'.swf')) {
          
          
$file_array[] = $s_file;
        }
      }
    }
    
    return 
$swf_path $file_array[floor(time() / 86400) % count($file_array)];
  }
  
?>

The HTML:
PHP Code:
<object>
  <param name="movie" value="<?php echo swf_rotator(); ?>" />
  <param name="quality" value="high" />
  <embed src="<?php echo swf_rotator(); ?>" quality="high" type="application/x-shockwave-flash" swliveconnect="true" pluginspage="http://www.macromedia.com/go/getflashplayer" />
</object>
__________________

<mgraphic /> - I don't have a solution but I admire the problem.

Last edited by mgraphic; 10-29-2006 at 07:32 PM.. Reason: Seen mistake
mgraphic is offline
Reply With Quote
View Public Profile
 
Old 11-01-2006, 01:28 PM Re: Rotating SWF Files...
Banned

Posts: 61
Name: Oh, don't go there
Location: United States
Trades: 0
Can't get this working either...

I don't know what the heck is causing my problem.

However, here's the page it's stuck on:

Code:
http://classicgames.servebeer.com/public/rotate.php
Tia
Frostydasnowman is offline
Reply With Quote
View Public Profile Visit Frostydasnowman's homepage!
 
Old 11-01-2006, 01:35 PM Re: Rotating SWF Files...
Banned

Posts: 61
Name: Oh, don't go there
Location: United States
Trades: 0
Basically, my problem is that the script loads, but not the swf, and the bottom of internet explorer (webrowser) 'crashes' meaning the loading bar moves very slow, but nothing is loading at all! Wait! Did I mention, I added some text into the body of the php? That loads, you might think it's cute.
Frostydasnowman is offline
Reply With Quote
View Public Profile Visit Frostydasnowman's homepage!
 
Old 11-01-2006, 01:57 PM Re: Rotating SWF Files...
Banned

Posts: 61
Name: Oh, don't go there
Location: United States
Trades: 0
I *think* I might know the problem...

How come if I drag an swf file from my desktop to IE, it asks me to save it, and doesn't just display it like it used to? I checked the mime type, and that was good, but if I choose open with, and select ie, it just doesn't do nothing.

That's odd to me
Frostydasnowman is offline
Reply With Quote
View Public Profile Visit Frostydasnowman's homepage!
 
Reply     « Reply to Rotating SWF Files...
 

Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off





   
RSS Feed  Feeds: RSS   JS   XML
RSS Feed  Feeds for this forum: RSS   JS   XML



Page generated in 0.41963 seconds with 12 queries