Integrating the Piecemaker 3D Gallery into your WordPress Theme

Integrating the Piecemaker 3D Gallery into your WordPress Theme

This tutorial will show you how to successfully integrate the Piecemaker 3D Flash image rotator into your WordPress theme. We’ll also discuss setting up a custom admin panel which will make it super easy for your users to make customizations to the rotator.

Piecemaker is a gorgeous, open-source, 3D Flash image rotator created by Björn Crüger from Modularweb. You can preview the piecemaker in action on Sansation, the first premium WordPress theme on ThemeForest to incorporate Piecemaker.

Piecemaker

Preview


Brief Overview

All of the files included in the ZIP file are already modified for you. We’ve also included a folder which has all of the default unmodified Piecemaker files. I recommend that you go check out the Piecemaker site and familiarize yourself with it before proceeding with the tutorial.


Step 1. Modify the ActionScript

The first step is to modify the ActionScript so that it’ll play nicely with WordPress. The ActionScript that comes with Piecemaker defines three values that the Piecemaker needs in order to function properly:

  • the XML Source
  • the CSS Source
  • the path to the images folder.

The XML Source defines the Picemaker’s various settings and allows you to define images and their descriptions. The CSS file styles the Piecemaker’s description panels, and the images directory tells the Piecemaker where to pull the images from.

Open up the FLA file named “piecemakerNoShadow.fla” and open the Actions window. In frame 1 you will see the actions below. Please note that you need Flash CS4 to open the source file.

In order for the Piecemaker to work properly within our WordPress theme, we need to dynamically set these variables. To achieve this, we will be using FlashVars. FlashVars are variables the we’ll set within our WordPress page template that will get passed to the flash movie when the page loads. Go ahead and delete the default actions in frame 1 of the flash file, and replace them with the following code:

stage.scaleMode = StageScaleMode.NO_SCALE;

// Pull in the Flashvars
var allFlashVars:Object = LoaderInfo(this.root.loaderInfo).parameters;

// Set the required variables for piecemaker
piecemaker.xmlSource = String(allFlashVars.xmlSource);
piecemaker.cssSource = String(allFlashVars.cssSource);
piecemaker.imageSource = String(allFlashVars.imageSource);
piecemaker.dispatchEvent(new Event("properties"));

The above ActionScript first loads in the FlashVars, and then replaces the default Piecemaker values with these new variables. Our Flash file is now all set to go. Publish the SWF and load your FTP client of choice.


Step 2. Upload Files and Folders

The next step is to upload the required files and folders into your WordPress theme’s directory. This tutorial assumes that you will be uploading everything directly into your theme’s main directory. Here is a list of the required items:

  • piecemakerCSS.css
  • piecemakerNoShadow.swf
  • piecemakerXML.xml
  • ‘images’ folder (with your images in it)
  • ‘swfobject’ folder (plus contents)
  • piecemakerXML.php (needde for use with the custom admin panel)

Step 3. Embed the SWF and set the FlashVars

The next step is to embed the SWF movie into your WordPress page template. We’ll be using SWFObject 2 to embed the movie, and we’ll also define the three FlashVars that we referenced in step one.

You first need to reference swfobject within the head of your page. To do so, open up your theme’s “header.php” file in your code editor of choice (mine’s BBEdit), and add the following code in the head of your page:

<script type="text/javascript" src="<?php bloginfo('template_url'); ?>/swfobject/swfobject.js"></script>

Next, open up the WordPress page template where you’d like the Piecemaker 3D Rotator to display, and paste the following code:

<div id="flashcontent">
<p>You need to <a href="http://www.adobe.com/products/flashplayer/" target="_blank">upgrade your Flash Player</a> to version 10 or newer.</p>
</div><!-- end flashcontent -->

<script type="text/javascript">
		var flashvars = {};
		flashvars.xmlSource = "<?php bloginfo('template_url'); ?>/piecemakerXML.xml";
		flashvars.cssSource = "<?php bloginfo('template_url'); ?>/piecemakerCSS.css";
		flashvars.imageSource = "<?php bloginfo('template_url'); ?>/images";
		var attributes = {};
		attributes.wmode = "transparent";
		swfobject.embedSWF("<?php bloginfo('template_url'); ?>/piecemakerNoShadow.swf", "flashcontent", "960", "610", "10", "<?php bloginfo('template_url'); ?>/swfobject/expressInstall.swf", flashvars, attributes);
</script>

Code Explaination

The bulk of the code is just your standard swfobject code used to embed a flash movie onto any webpage. The important stuff we need to be concerned with are the FlashVars:

flashvars.xmlSource = "<?php bloginfo('template_url'); ?>/piecemakerXML.xml";
flashvars.cssSource = "<?php bloginfo('template_url'); ?>/piecemakerCSS.css";
flashvars.imageSource = "<?php bloginfo('template_url'); ?>/images";

Notice that we have named our FlashVars just as we defined them in the ActionScript in step on4. We are also using WordPress’ built-in bloginfo() function to reference the exact locations of the three required files.

That’s it! Well, Sort of…

The above steps will enable you to successfully deploy the Piecemaker 3D Image Rotator into your WordPress theme, but we’re going to take it a step further. In the following steps, we will discuss how to create a custom admin panel that will allow you to customize Piecemaker’s settings right from the WordPress back-end.

If you’re not interested in setting up the admin panel, you can go over to the Piecemaker website to read the documentation and start making some really kick-awesome animations.


Step 4. Create The Admin Panel

We will not be covering how to create the entire admin panel from scratch. Instead, we’ll expand upon an already in-depth tutorial here on Nettuts: How to Create a Better WordPress Panel.

Once you have followed that tutorial and you have your admin panel setup, please proceed to the next step.


Step 5. Define Our New Options Panel

We now need to add additional options to the admin panel you just created in the tutorial. Open your theme’s “functions.php” file, and replace the first chunk of code with the following:

<?php
$themename = "Nettuts";
$shortname = "nt";

$categories = get_categories('hide_empty=0&orderby=name');
$wp_cats = array();
foreach ($categories as $category_list ) {
       $wp_cats[$category_list->cat_ID] = $category_list->cat_name;
}
array_unshift($wp_cats, "Choose a category"); 
$tween_types = array("linear","easeInSine","easeOutSine", "easeInOutSine", "easeInCubic", "easeOutCubic", "easeInOutCubic", "easeOutInCubic", "easeInQuint", "easeOutQuint", "easeInOutQuint", "easeOutInQuint", "easeInCirc", "easeOutCirc", "easeInOutCirc", "easeOutInCirc", "easeInBack", "easeOutBack", "easeInOutBack", "easeOutInBack", "easeInQuad", "easeOutQuad", "easeInOutQuad", "easeOutInQuad", "easeInQuart", "easeOutQuart", "easeInOutQuart", "easeOutInQuart", "easeInExpo", "easeOutExpo", "easeInOutExpo", "easeOutInExpo", "easeInElastic", "easeOutElastic", "easeInOutElastic", "easeOutInElastic", "easeInBounce", "easeOutBounce", "easeInOutBounce", "easeOutInBounce");

The bulk of the above code is identical to the tutorial, but we’ve added a new array named $tween_types. This array holds all of the various animation effects that are available with PieceMaker. We will use this array to generate a dropdown list of the various animation effects in our custom options panel. You can check out the Tweener Documentation to review a visual representation of the various Piecemaker animation effects.

Still within the functions.php file, add the following array below the ones you’ve already created in the tutorial.

This will create a new sliding options panel similar to the ones you created in the tutorial. It’s a long bit of code, but it follows the same exact logic as the tutorial. We are simply creating variables for all of the different settings that we’ll need to define in the Piecemaker’s XML file. An important thing to note is that we made sure to define default values for each option (the values in ‘std’ are the default values). There are a decent amount of settings for the Piecemaker and we don’t want to force our users to set up all those options if they don’t want to.

array( "name" => "3D Rotator Options",
"type" => "section"),
array( "type" => "open"),

array( "name" => "Segments",
"desc" => "Number of segments in which the image will be sliced.",
"id" => $shortname."_segments",
"type" => "text",
"std" => "9"),

array( "name" => "Tween Time",
"desc" => "Number of seconds for each element to be turned.",
"id" => $shortname."_tween_time",
"type" => "text",
"std" => "3"),

array( "name" => "Tween Delay",
"desc" => "Number of seconds from one element starting to turn to the next element starting.",
"id" => $shortname."_tween_delay",
"type" => "text",
"std" => "0.1"),

array( "name" => "Tween Type",
"desc" => "Type of animation transition.",
"id" => $shortname."_tween_type",
"type" => "select",
"options" => $tween_types,
"std" => "Choose a category"),

array( "name" => "Z Distance",
"desc" => "to which extend are the cubes moved on z axis when being tweened. Negative values bring the cube closer to the camera, positive values take it further away. A good range is roughly between -200 and 700.",
"id" => $shortname."_z_distance",
"type" => "text",
"std" => "25"),

array( "name" => "Expand",
"desc" => "To which etxend are the cubes moved away from each other when tweening.",
"id" => $shortname."_expand",
"type" => "text",
"std" => "9"),

array( "name" => "Inner Color",
"desc" => "Color of the sides of the elements in hex values (e.g. 0x000000 for black)",
"id" => $shortname."_inner_color",
"type" => "text",
"std" => "0x000000"),

array( "name" => "Text Background Color",
"desc" => "Color of the description text background in hex values (e.g. 0xFF0000 for red)",
"id" => $shortname."_text_background",
"type" => "text",
"std" => "0x666666"),

array( "name" => "Text Distance",
"desc" => "Distance of the info text to the borders of its background.",
"id" => $shortname."_text_distance",
"type" => "text",
"std" => "25"),

array( "name" => "Shadow Darkness",
"desc" => "To which extend are the sides shadowed, when the elements are tweening and the sided move towards the background. 100 is black, 0 is no darkening.",
"id" => $shortname."_shadow_darkness",
"type" => "text",
"std" => "25"),

array( "name" => "Auto Play",
"desc" => "Number of seconds to the next image when autoplay is on. Set 0, if you don't want autoplay.",
"id" => $shortname."_autoplay",
"type" => "text",
"std" => "2"),

array( "type" => "close"),

Step 6. Update Our Page Template

In this step, we need to slightly modify our WordPress page template from Step three. Instead of pointing our xmlSource to an XML file, we need to point it to a PHP file. By using a PHP file instead of an XML file, we can pull in all of the values that were set by the user in our custom options panel. It’s just the one line of code that needs to be replaced:

flashvars.xmlSource = "<?php bloginfo('template_url'); ?>/piecemakerXML.php";

Step 7. Generate our XML File with PHP

We’re almost there! In this step, we’ll create the PHP file that we just referenced in the code above. This PHP file will be used to pull in all of the values from our custom options panel and generate the XML file that the Piecemaker needs in order to function properly. The code is somewhat lengthy, so I’ll try to break it up into more digestable chunks.

Create a blank PHP file, name it “piecemakerXML.php”, and paste the following code at the start of the file:

<?php require_once( '../../../wp-load.php' );
$segments = get_option('nt_segments');
$tweentime = get_option('nt_tween_time');
$tweendelay = get_option('nt_tween_delay');
$tweentype = get_option('nt_tween_type');
$zdistance = get_option('nt_z_distance');
$expand = get_option('nt_expand');
$innercolor = get_option('nt_inner_color');
$textbackground = get_option('nt_text_background');
$textdistance = get_option('nt_text_distance');
$shadow = get_option('nt_shadow_darknent');
$autoplay = get_option('nt_autoplay');
?>
  • The first line loads WordPress into our PHP file. This allows us to have access to all of the default WordPress functions, as well as any values stored within our database.
  • The rest of the code pulls in the data from our custom options panel and stores those values into variables. We will use these variables to generate the rest of the Piecemaker’s settings.
  • Next, we need to set the content-type header so that the browser knows we are going to output XML content rather than the default text/html. We will also include some initial Piecemaker settings tags.

    <?php
    header("Content-type: text/xml");
    echo '<?xml version="1.0" encoding="utf-8" ?>
    <Piecemaker>
      <Settings>
    	<imageWidth>830</imageWidth>
    	<imageHeight>360</imageHeight>';
    

    We are now going to output the variables we stored into their correct XML tags, and close out the Piecemaker settings tag.

    echo '<segments>'. $segments . '</segments>';
    echo '<tweenTime>'. $tweentime . '</tweenTime>';
    echo '<tweenDelay>'. $tweendelay . '</tweenDelay>';
    echo '<tweenType>'. $tweentype . '</tweenType>';
    echo '<zDistance>'. $zdistance . '</zDistance>';
    echo '<expand>'. $expand . '</expand>';
    echo '<innerColor>'. $innercolor . '</innerColor>';
    echo '<textBackground>'. $textbackground . '</textBackground>';
    echo '<textDistance>'. $textdistance . '</textDistance>';
    echo '<shadowDarknent>' . $shadow . '</shadowDarknent>';
    echo '<autoplay>' . $autoplay .  '</autoplay>'; 
    echo '
    </Settings>
    

    The final step is to output the images that we want to include in the rotator along with their descriptions, and we’ll also close out the Piecemaker XML tag.

    <Image Filename="image1.jpg">
        <Text>
          <headline>Description Text</headline>
          <break>Ӂ</break>
          <paragraph>Here you can add a description text for every single slide.</paragraph>
          <break>Ӂ</break>
          <inline>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam eu quam dolor, a venenatis nisl. Praesent scelerisque iaculis fringilla. Sed congue placerat eleifend.</inline>
          Ӂ<a href="http://themes.5-squared.com/sansation/?style=cool_blue" target="_blank">hyperlinks</a>
        </Text>
      </Image>
      <Image Filename="image2.jpg">
        <Text>
          <headline>Description Text</headline>
          <break>Ӂ</break>
          <paragraph>Here you can add a description text for every single slide.</paragraph>
          <break>Ӂ</break>
          <inline>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam eu quam dolor, a venenatis nisl. Praesent scelerisque iaculis fringilla. Sed congue placerat eleifend.</inline>
          Ӂ<a href="http://themes.5-squared.com/sansation/?style=cool_blue" target="_blank">hyperlinks</a>
        </Text>
      </Image>
      <Image Filename="image3.jpg">
        <Text>
          <headline>Description Text</headline>
          <break>Ӂ</break>
          <paragraph>Here you can add a description text for every single slide.</paragraph>
          <break>Ӂ</break>
          <inline>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam eu quam dolor, a venenatis nisl. Praesent scelerisque iaculis fringilla. Sed congue placerat eleifend.</inline>
          Ӂ<a href="http://themes.5-squared.com/sansation/?style=cool_blue" target="_blank">hyperlinks</a>
        </Text>
      </Image>
      <Image Filename="image4.jpg">
        <Text>
          <headline>Description Text</headline>
          <break>Ӂ</break>
          <paragraph>Here you can add a description text for every single slide.</paragraph>
          <break>Ӂ</break>
          <inline>Lorem ipsum dolor sit amet, consectetur adipiscing elit. Aliquam eu quam dolor, a venenatis nisl. Praesent scelerisque iaculis fringilla. Sed congue placerat eleifend.</inline>
          Ӂ<a href="http://themes.5-squared.com/sansation/?style=cool_blue" target="_blank">hyperlinks</a>
        </Text>
      </Image>
    </Piecemaker>';
    ?>
    

    Conclusion

    I hope you learned something useful in this tutorial. By combining various different technologies, we’re able to add powerful functionality to our WordPress themes. More importantly, we made it easy for the average user to make customizations to our theme.

Tags: Flash
Note: Want to add some source code? Type <pre><code> before it and </code></pre> after it. Find out more
  • http://theoldskoolblog.com Gunjan

    Very useful tutorial….tnx :)

  • http://www.philohermans.com Philo Hermans

    Nice tutorial! :)

  • Paulu

    Very interesting tutorial. I will it use on my next project!

  • Christophe

    Hah, this was exactly what I was waiting for, thanks!

  • Bryan

    Waw! that looks awesome, thanks alot. Ill be looking foward to start implemetning this in new projects ;)
    Thanks!

  • http://www.kordopatis.com Constantine

    Need it!
    Awesome tutorial.
    Thank you.

  • http://www.pinoyscreencast.com techie.biox

    thanks! I’ve been looking for this integration I just saw the theme on themeforest and I wondered what kind of flash they had use on that theme..coz I usually use the Cu3er , this really helps …

  • http://psdho.me PSDhome – Everyday free PHOTOSHOP files

    Amazing effect. Very good tutorial. Thanks.

  • http://design-creators.net Alexander Trefz

    This is…. not really useful. How to get a FLASH-Image-Rotator in a WordPress-theme? This is not what flash is made for. This is what JavaScript is made for. And this is possible with JavaScript.

    • http://www.5-squared.com 5-squared

      Hi Alexendar,

      I am sorry you do not find this useful. If you know of a javascript effect that can achieve these same 3D effects i would love to check it out. Please share the link us.

      Cheers.

  • Eric

    Great Tut and very well explained. I was wondering how to do this with cu3er, but maybe I will just switch to Piecemaker. Thanks.

  • http://www.designfollow.com designfollow

    great tutorial.

    thank you very much.

  • http://www.depotwebdesigner.com freemh

    thanks for this I will it use on my next project, great tutorial

  • http://www.deluxeblogtips.com Deluxe Blog Tips

    Very nice tutorial. I just not fully satisfy with Piecemaker that it has only one effect. I prefer CU3ER because it has many effects for transformation, and it has a plugin for WordPress, too. I hope in the future, Piecemaker will add more options and effect and it will be great.

    • http://www.5-squared.com 5-squared
      Author

      Hi Deluxe,

      I agree with you. I would prefer it if you could have multiple transitions instead of just the single animation. Who knows, maybe this will be included in a future release of Piecemaker?

      However, the big advantage that Piecemaker has over the cu3er is that it is completely free and open-source. If you ever plan to implement cu3er into a website template or wordpress theme you’ll need to pay a $1,000 for a license.

      • http://www.ucarmetin.com Metin Ucar

        $1,000 for a license?
        But I thought Cu3er is for free =(

      • http://www.nashvilleinteractive.com a website designer

        I thought cu3er was free of charge for personal and commercial… http://www.progressivered.com/cu3er/about.htm ? (unless you’re talking about reselling it I guess)

        Either way I think the main take away is the custom panels and configuring Flash options via the WP admin area. I’ve been wondering how to do this for a while but hadn’t found any concise tuts/explanations until you posted this. It’s so easy once someone enlightens me. Thanks for the knowledge.

        P.S. I’d love to see a tut on how to read WP post/page data (or any WP database info) into a Flash movie. I’m sure this post will get me started but…

  • http://www.jordanwalker.net Jordan Walker

    Wonderful tutorial regarding implementation of that fancy image player.

  • http://www.drummerboyhosting.com Atlante

    Anyway we can get it to pull an image from a certain category like “featured” by default? Now that would be totally useful!!!! Thanks for the tutorial though the custom admin panel was a great addition!!!

    • http://www.5-squared.com 5-squared
      Author

      Hi Atlante,

      This is a great suggestion. I think it would certainly be possible. You would just have to expand on the PHP file that is generating the XML. Instead of hard-coding those images in there you would need to write a wordpress loop that pulls in posts of a certain category and then spits out the information laid out the correct XML tags.

      Maybe I will work on this in my free time (which is non-existent at the moment), and I will post the code here for everyone to have. If someone with some more time on their hands wants to tackle this, I’m sure we would all appreciate it very much.

      Cheers.

      • http://contempographicdesign.com/ Chris Robinson

        Here ya go:

        Flash Embed: http://pastie.org/931023
        XML: http://pastie.org/931020

        You’ll need to either make a custom write panel or manually create a custom field in each post for the image like so:

        Name: image_value
        Value: (the url)

        Now if you notice in the flash embed code I’ve specified the imagesource to be /wp-content/uploads/ now this means when you upload your images through the WP admin you’ll need to remove the first http://yourdomain.com/wp-content/uploads bit from the file URL when you paste them into your custom fields.

        This is a drawback to the way Piecemaker is coded, due to the fact you have to specify a folder from which your images are pulled from. Would be nice if you could remove the flashvars.imageSource from the embed and use absolute URL’s in the XML.

        Also note you’ll need to upload your images at the exact size of your gallery.

        Hope that helps ya ;)

      • http://www.themedigital.com Cosmin

        Chris, you’re a rockstar! Thanks a lot for taking the time to share this :)

    • http://www.5-squared.com 5-squared
      Author

      Awesome work Chris! Thanks a lot for the contribution.

  • Khalil

    This is very cool.

    thanks

  • http://www.andreabarghigiani.info Andrea Barghigiani

    Am my the only one having trouble with this implementation???

    Anyone has this kind of errors:
    - Symbol ‘piecemaker’ 1017: The definition of base class PieceMaker was not found.

    • http://www.5-squared.com 5-squared
      Author

      Hi Andrea,

      I’m assuming the error is appearing in flash? I haven’t seen this error before. if you are trying to modify the FLA file, you need to be sure that the file is in the same folder as the “caurina” and “com” folders.

      Perhaps you can try downloading the source files directly from Piecemaker to see if that fixes your issue? Just remember you will need to update the ActionScript as outlined in the tutorial.
      http://www.modularweb.net/piecemaker/

      Cheers.

  • http://www.ucarmetin.com Metin Ucar

    This would an awesome addition to my upcoming website.
    Thanks for the tutorial.

  • http://www.ucarmetin.com Metin Ucar

    Hi there,

    I’ve been implementing 3D gallery into WP. Everything is working well when I use the flash vars below.

    flashvars.xmlSource = “/piecemakerXML.xml”;

    But, when I replaced it with the following code as suggested in Step 6,

    flashvars.xmlSource = “/piecemakerXML.php”;

    the 3D rotator does not show up.

    Any idea on what I’m doing wrong? really appreciate your help in advance.

    note: As I’m integrating 3D rotator in one of the Woo Themes, I’ve copied the functions of 3D rotator from functions.php file and pasted in theme-functions.php, where Woo Themes functions are located. Besides, I had to modify the code slightly to make it fit the Woo Theme function structure.

    • http://www.5-squared.com 5-squared
      Author

      Hi Metin,

      It sounds like the XML file is not being properly generated.

      You say you are implementing this into your WooTheme. Have you followed the tutorial described in Step 4 for creating the custom admin panel? If not, the PHP file you are calling to generate the XML will not return any values.

      • http://www.ucarmetin.com Metin Ucar

        Here is the code I modified and added to the WooThemes functions file. Any idea on what is wrong?

        http://pastie.org/934144

    • http://www.divinedeveloper.com/ Mladjo

      Did you check that $shortname = “woo”; from woo themes match prefix in piecemakerXML.php
      example:
      $segments = get_option('nt_segments');
      nt is the prefix and should be:
      $segments = get_option('woo_segments');

      • http://www.ucarmetin.com Metin Ucar

        Hey Mladjo,

        How come I didn’t see that.
        Thank you. The problem is resolved.

        Regards.

    • http://www.nashvilleinteractive.com a website designer

      I had the same problem. Found out via firebug that the XML.php was generating a 500 error. It was being caused because I had placed all my files into a “rotator” subdirectory within my theme directory. I just needed to add an extra ../ to get the path to wp-load.php correct – require_once( ‘../../../../wp-load.php’ );

      Hope it helps…

  • http://www.divinedeveloper.com/ Mladjo

    I was in the process of integrating piecemaker in my next theme and even had actions frame opened trying to figure out what to do when I found this great article which saved me lots of time. Then i took Chris Robinsons code and with simple str_replace php function made possible to have custom image meta with full url to the image. Also two options are passed from theme options panel, category name and number of posts/slides to be shown. Here is the code http://pastie.org/934104
    “Organize my uploads into month- and year-based folders” from wordpress dashboard/settings/miscellaneous must be unchecked!

    • http://www.5-squared.com 5-squared
      Author

      Mladjo,

      I’m glad you found this tutorial useful. Thanks so much for sharing your additional functionality!

    • http://sektorrd.com Adrian

      I’m trying to use your method , but I’m doing something wrong… In fact the flash is placed well, but it doesn’t get beyond the loading state (welcome) ,images are not loaded.

      I thought it was because I’m using in my category.php to change the template according to the category id:


      $post = $wp_query->post;

      if (in_category('3') || post_is_in_descendant_category(3)) {
      include(TEMPLATEPATH.'/layouts/blog.php');
      } elseif (array(in_category('4','8','9','10','11','12','13','14','16','17', '18','19','21','22','26')) || array(is_category('4','8','9','10','11','12','13','14','16','17', '18','19','21','22','26')) || is_single() ) {
      include(TEMPLATEPATH.'/layouts/products.php');
      } else {
      return;
      }

      but this, should not make any conflict isn’t?

      but well the complete story is here:

      http://pastie.org/969013

      hope you can give me a hand on this!

      a thanks for share!

  • http://akin.sidmad.com Akin

    Really great plugin and useful tutorial. Thanks so much for preparing. I implemented the piecemaker to my html theme, but I’m having trouble with hyperlinks in the description. Whenever I click hyperlink, I see a flash player warning and allow flash player to open a link but nothing happens :S (in all browsers including firefox, chrome, safari and ie) but in your theme Sansation (http://themeforest.net/item/sansation-business-portfolio-premium-wordpress/97112) and on piecemaker website, hyperlinks work perfectly. what should I do to get hyperlinks work like that?

    • http://www.5-squared.com 5-squared
      Author

      Hi Akin,

      I’m not 100% certain what’s causing the issue, but here are a few things to check out.

      - Are your hyperlinks set up the same way they are outlined in this tutorial?
      - Are you embedding the movie via swfobject as outlined in this tutorial?
      - Are you viewing the movie locally or on your web server? (perhaps viewing locally causes an issue?)

      You can also try to download the original files from Modularweb and try that out to see if you run into the same error. Then compare your XML file and see if there are any differences.
      http://www.modularweb.net/piecemaker/

      Hope this helps.

      • http://akin.sidmad.com AkinGn

        Thank you very much Sean, I think that’s because I’m viewing locally, as you pointed out. Thanks again :)

  • Ricardo Miller

    very nice tutorial but i am having one problem the scripts works fine in wordpress using the

    flashvars.xmlSource = “/piecemakerXML.xml”;

    but when i change piecemakerXML.xml to piecemakerXML.php it does not work i have download the source and set it up the way you describe but i can’t figure out the problem

    • http://www.5-squared.com 5-squared
      Author

      Hi Ricardo,

      It might have to do with the path of ‘wp-load.php’ at the start of the PHP file.

      Where is your theme installed? Is it only one folder deep?

      If it is 2 or more folders deep (ie: wp-content/themes/folder/yourtheme), you will need to update the first line of the code in the PHP/XML file so it is referencing the correct directory for wp-load.

      So, if your theme is 2 folders deep you need to add an additional “../” .If its 3 folders deep you need to add “../../” , etc…Here’s updated code:

      <?php require_once( '../../../../wp-load.php' );

      If your theme is indeed only one folder deep it could be something else. Do you have a link to the site?

      Cheers.

      • GandalfGrey

        I get the same problem as Ricardo.
        When i look in firebug i can see that picemakerXML.php reports // Cannot modify header information – headers already sent //

  • http://www.scottrockers.com Scott Rockers

    Amazing tut, thanks for posting.

  • http://www.outerspiceweb.com Brian McCulloh

    Awesome tut! My images are 960px by 350px, and I set the object to 960px by 350px, and I even adjusted the XML for imagewidth of 960px and imageheight of 350px, but it’s cutting off the top of my image. I cannot figure out what the problem is. Is there some padding or margins somewhere in the flash object that I can’t edit? Please help.

    • http://www.outerspiceweb.com Brian McCulloh

      Man I’m really lost here. Where is it getting that welcome image at the beginning, and why is it only like 600px wide? I can’t believe no one else has wanted this thing to fit into a 960px wide template yet… what gives???

      • Joss

        I’m having the same problems! I want to use a smaller image then the default (I want 775px wide, but only 275px high) and it just cuts of the first 50-100px or so.

        with:
        swfobject.embedSWF(“[...]/piecemakerNoShadow.swf”, “flashcontent”, “775″, “275″, “10″ etc etc
        the top gets cut off

        with:
        swfobject.embedSWF(“[...]/piecemakerNoShadow.swf”, “flashcontent”, “775″, “375″, “10″ etc etc
        it’s okay, but then there is 100px of padding/margin at the bottom which pushes everything down.

        And BTW, that welcome image is embedded in the FLA/SWF file, you can change it there if you need to. (would have been better if it used some kind of preloader like cu3er does)

    • http://www.conceptcreation.com CR

      Don’t know if it will help in your situation, but I found that if I opened the original FLA document and resized the stage to be about 160 – 200 px wider than my desired image, adjusted the height proportionally (so for a 940 x 420 image, my flash size was 1100 x 492) and then republished and used that version, it gave enough room for the 3D turns to happen without the flash getting cut off or squished. If you do that though, make sure and re-center the movie clip holders on the main stage so that they are in the center of the resized stage, or your images and buttons will all be off-center.

      I still see some clipping depending on how many segments I break the image into (more segments mean the ‘ripple’ to the side takes more space). I would be really interested to know if anyone knows exactly how much padding area should ideally be left around the image on the top and bottom, but the fix I described above worked for me for now.

    • Akshay

      When the 3D Transition is applied it will require more area and hence we need to specify slightly more height and width.The height and width should depend on some of the settings about the transition specified in the XML file

    • http://www.televisionkillsme.org daniele

      same problem, can’t find a way to display the images correctly…
      my images are 686 px per 300 px in height.

  • Josh

    After spending ALL DAY trying to get this to work (I’m not a web guy) I came up with this simple solution for wordpress users. It won’t work for ‘custom theme creation’, but it definitely works.

    USE THE MODIFIED PIECEMAKER FILES INCLUDED IN THE TUTS PIECEMAKER WP TUTORIALS. COPY THEM TO A FOLDER ON YOUR SERVER, I CHOSE A FOLDER CALLED IMAGES.

    PUT THIS IN YOUR HEADER (MY FILES WENT INTO A FOLDER CALLED ‘IMAGES’, SO YOU WILL NEED TO MAKE SURE YOU CHANGE THIS IF THE LOCATION IS DIFFERENT)

    PUT THIS (OR SOMETHING SIMILAR) IN A FLASH EMBED PLUGIN (I USED KIMILI FLASH EMBED)

    [kml_flashembed publishmethod="dynamic" fversion="8.0.0" replaceId="feature" movie="/images/piecemaker/piecemakerNoShadow.swf" width="400" height="300" targetclass="fmedia" fvars="xmlSource = /images/piecemaker/piecemakerXML.xml;
    cssSource = /images/piecemaker/piecemakerCSS.css;
    imageSource = /images/piecemaker/images/"]

    [/kml_flashembed]

    Done

    • josh

      For some reason, it wouldn’t let me enter the script. I’m trying again but you will need to put the at the end of the second script.

      It shoulda read something like this:

      PUT THIS IN YOUR HEADER (MY FILES WENT INTO A FOLDER CALLED ‘IMAGES’, SO YOU WILL NEED TO MAKE SURE YOU CHANGE THIS IF THE LOCATION IS DIFFERENT.

      script type=”text/javascript” src=”/images/piecemaker/swfobject/swfobject.js”></script

  • http://sektorrd.com Adrian

    Hey Hi!

    I got a problem , suddenly the Piecemaker stop working, I use @ChrisRobinson Method…… and all was working right . I don’t know what happened ..

    The last thing I do , was add a new post , but to another category that is not the one pointing to the Piecemaker.

    Also I add some function to function.php…. but this alters another category that is not the one pointing to picemaker

    Somebody know what could it be?

    thanks in advance

    • Anand

      ReferenceError: Error #1069: Property perspectiveProjection not found on flash.geom.Transform and there is no default value.
      at com.modularweb.imageGalleries:ieceMaker/stageResized()
      at com.modularweb.imageGalleries:ieceMaker/initiate()
      at flash.events::EventDispatcher/dispatchEventFunction()
      at flash.events::EventDispatcher/dispatchEvent()
      at flash.net::URLLoader/onComplete()

      am getting this error in firefox.
      may i know the solution.

      Thanks
      A Anand

  • http://www.cubo-x.com Ivan

    very nice tut, i had some problems when i trying to implent but all it has been resolve now, just some tips from my experience:

    1.- check the require_once path
    2.- check the call get_option function to the correct $shortname variable
    3.- for a some reason, my piecemakerXML.php didn’t work due double tags or mybe some character, i didn’t know but i get resolve this problem adjust this stuffs or copying the picemakerXML.xml content to my picemarkerXML.php file to test and changing all the variables and adding the get_option functions.

  • http://www.xcellence-it.com Xcellence IT

    hey thats a great tutorial.. thanks

  • http://www.xcellence-it.com Xcellence IT

    hey thats a great tutorial.. thanks.

    I’m going to implement this one in one of the wordpress theme I’m currently working on.

  • milo

    sounds complicate just for a simple photo transition to set up

  • JLee

    Hello,

    We used PieceMaker in a WordPress theme for ThemeForest. It works fine in all of our tests. But a few clients said that it is not working and they only see the shadow below but no images. We checked if they were missing something but everything was like we initially did.

    We tried changing

    <?php require_once( '../../../../wp-load.php' );

    But the problem is not caused by it.

    Any suggestions?

  • Tom

    Has anyone released Peicemaker 3d as a plugin for wordpress rather than having to go through this painstaking process? Would be great if someone offered it as a downloadable plugin where you just install the plug in to wordpress and choose the page you want the image slider to appear on etc…

    any ideas??

  • Cedric W

    Script works fine with the .xml file, but when I change it to the xml.php file, it flashes the default image once and disappears. It does seem to be reading the image files, however, if I type in the wrong image name, it shows the grey default welcome image. In firebug, the images that are supposed to show are loaded correctly, it just doesnt show at all. Not sure if the wp-load directory fix applies here…just wondering if you have any ideas for a fix. For now I’m just using the raw XML file.

    • banannah

      i had the same problem, but think it was related to the fact that I did a find and replace in the xmp.php file to replace “nt” with my own $shortname. of course it replaced every instance of “nt” so it messed up any words with “nt” in them like “content” etc. I just decided was easier to just change the $shortname back to “nt”, but maybe check that you are referencing the right $shortname from your functions.php (or whatever u r using – I am using a separate file called theme_options.php) in your xml.php file…hope it helps.

      Awesome tutorial btw – much appreciated :)

  • http://www.tenaxtechnologies.com java developer

    Very interesting tutorial. I will it use on my next project!

  • http://www.vishu.net/wordpress Vishu

    Very interesting tutorial, I had a problem while implementing the php that generates the xml cuz I forgot to update the imageSource parameter in the html, but it’s all perfect now :)

    Thanks again Sean!

  • Paw

    Hello!!

    Great tutorial, thanks!

    I have embedded this once in a wordpress them and it worked perfectly…. Recently i have tried again and i have very strange problem. I can not change images!! no matter what i change in XML file it won’t take the effect. I can even delete XML file and Piecemaker will load anyway still with those default images…

    Anyone have an idea what could be wrong??

    Thanks

  • http://www.televisionkillsme.org daniele

    PLEASE SOMEONE HELP ME!

    i can’t get piecemaker display images correctly!
    images are 686 x 300 pixels, i set these values for piecemaker..
    i do not manage to get everything working fine!

    first value i put: “686″, second “350″ and the third? what’s “10″ stand for?

    please someone could answer?

    televisionkillsme.org

  • John

    Hi Sean, please post a tutorial on embedding piecemaker swf in a facebook page.

  • http://3aroundweb.in/ Niraj

    very useful article … thanks :)

  • Iveau

    Hey!

    This is really usefull! But is there maybe an opportunity that I can put .swf’s instead of images?
    Can anyone please help me?

    Thanks!

  • http://kennyoncrush.com Kenny

    I literally have no idea what the tutorial is saying to do.. I really love the piecemaker, but I haven’t got a clue how to add it to my wordpress.. if someone could help I’d be very grateful

    - Kenny

  • http://mtspacewebdesign.com/ Matt

    Hello,

    I’ve gotten Piecemaker to work properly in my wordpress theme, but am having issues with how the images are displaying. If you go to http://mtspacewebdesign.com/glodis2/ you’ll see what I’m talking about. All the images were the same size and are now varying in height in the piecemaker rotation.

    Any thoughts?

    Matt

  • http://www.uniqueengagementringsnj.com Jen

    I got a theme that supposedly has piecemaker loaded in it – there is a place in the admin for the tweens and all that, but it’s not working properly. Is there anyone who can tell me what’s missing in the code that’s keeping it from changing the pictures?
    Thanks.

  • Naushad

    Thanks, this is indeed the Best Plugin for wp..

    But now as we have the Piecemaker 2 Available for wordpress, can you please describe steps in integrating the same in THeme via the Plugin itself…..

  • http://dimsor.com Mike

    is there an easy way or short way to create piecemaker?

  • http://www.schottenblog.de Chris

    Hi,
    I wanted Geard the plugin installed on my blog but unfortunately I got when I activate the plugin the message: The plugin has no valid header, so I could not abschleißen the installtion.
    My question: what can I do now at this great plugin to use.

    p.s.
    I use the latest WordPress version

  • Dejan

    Piecemaker 2 isn’t working wih WordPress 3.0.5. Fix it!

  • Ruled

    @Dejan, shut up! Its a very unfriendly behaviour to tell people to: “Fix it!” if they provide you some great piece of code for free. Think about it!

  • Amzad

    Hi, during implementing this slider i have got two compile error
    1017: The definition of base class PieceMaker was not found.
    5000: The class ‘com.modularweb.imageGalleries.PieceMaker’ must subclass ‘flash.display.MovieClip’ since it is linked to a library symbol of that type.

    when i am going to publish piecemakerNoShadow.fla files dynamic code given above.Please solve this for me i need this real quick !!!!!!!!!!

  • amzad

    I have solved the first problem . but i have got wrong in my action script during implementing piecemaker
    it can not load XML .it is used his built in image.I have got this output msg when i am opening swf file piecemakerNoShadow.swg in Flash CS4……Help me out ….

    Error #2044: Unhandled ioError:. text=Error #2032: Stream Error. URL: file:///C|/wamp/www/wordpress/wp%2Dcontent/themes/bpm/undefined
    at com.modularweb.imageGalleries::PieceMaker/loadXML()
    at flash.events::EventDispatcher/dispatchEventFunction()
    at flash.events::EventDispatcher/dispatchEvent()
    at piecemakerNoShadow_fla::MainTimeline/frame1()