Dynamic photo galleries
Ecommerce solutions
Website design
Wordpress design

Dynamic Flash media gallery

March 31st, 2010

I wanted a way to add new galleries without having to create a new auto.php
file for each gallery , I also needed to add the folder directory name dynamically.

After trying many different configurations here’s what works perfectly.

1:Place your flash media gallery files in the root of your theme
flashdetect.js
mediaGallery.swf
auto.php
styles.txt

2:Place your gallery directory in the root of your theme
myprojects
Then inside myprojects directory create your directories for galleries
myprojects/project1/01_pictures and 02_Videos
Then maybe
myprojects/project2/01_pictures and 02_Videos

3: The SWFObject
Add this to the single.php post template in your wordpress theme or whatever post template you prefur.

<div id="flashcontent">
<h1>Sorry!</h1>
It looks like you don't have flash player 6 installed.
<a href="http://www.macromedia.com/go/getflashplayer">Click
here</a> to go to Macromedia download page.

</div>
<!--p $flash = get_post_meta($pos-->ID, 'gallery', $single = true); ?&gt;
<script src="../../../flashdetect.js" type="text/javascript"></script><script type="text/javascript">// <![CDATA[
var so = new SWFObject("http://yoursitename.com/wp-content/themes/themename/mediaGallery.swf", "gallery", "100%", "650", "6", "#404B5C");
so.addVariable("data_source", "http://yoursitename.com/wp-content/themes/themename/auto.php?myprojects/project=")
so.write("flashcontent");
// ]]></script>

4: Setup auto.php
Open auto.php with notepad and edit this line
$file_dir=”content”;
Change that line to
$file_dir = $_GET['project'];
Then scroll down to this line
$tmp_str = ‘
Change that line to
$tmp_str = ‘ (The reason for this is mediaGallery.swf needs the full url to gallery directories)
Now upload auto.php back to your theme root

5: Create a new gallery post
Login to wordpress and click on add a new post

Add your content describing your new gallery then scroll down to Add new custom field:
For the name insert flash
For the value insert the name of the first gallery folder name in your
newly created gallery directory which would be project1.

Now click enter new then publish and view your new post with the gallery included!

Conclusion
After the initional setup, simply upload new gallery folder to myprojects and repeat step 5……….




No Comments

No comments yet.

Leave a comment