ZenPhoto + FLV files, a few improvements and hacks

My profuse thanks to all the developers for a fantastic piece of software. It continually impresses me.

For a recent project, I had to tweak the FLV (FlashVideo) functionality a bit. In the spirit of sharing, here's what I did.

Specifically, I wanted video thumbnails. Currently, to get thumbnails for FLV files, one uploads an FLV file, and a custommade JPEG thumbnail -- both in the same folder and with the same filename. Albums and index pages will show the JPEG as a thumbnail, and the image page will show the FLV file.

What I wanted was to also load this thumbnail as the FLV player default thumbnail: meaning, looking at the image page, there's not only a blank FLV player waiting to be played, but a FLV player showing the thumbnail until play is pressed, at which point the FLV takes over.

To do this, I tweaked version 1.1.5 of zp-core/template-functions.php line 1846 and replaced it with this:

` if ($ext == ".flv") {

//Player Embed...

$videoThumb = preg_replace("/.flv/i", ".jpg", getFullImageURL());

echo '

Get Flash to see this player.



var so = new SWFObject("' . WEBPATH . '/' . ZENFOLDER . '/flvplayer.swf","player","500","395","8");

so.addParam("allowfullscreen","true");

so.addVariable("image","' . $videoThumb . '");

so.addVariable("file","' . getUnprotectedImageURL() . '&title=' . getImageTitle() . '");

so.addVariable("backcolor","0x000000");

so.addVariable("frontcolor","0xffffff");

so.addVariable("lightcolor","0xcccccc");

so.addVariable("displayheight","375");

so.write("player");

';

}`

Result can be seen here: http://www.whodidit.dk/

Comments

  • acrylian Administrator, Developer
    Just to mention: if you submit modifications you should always use the latest nightly build, flv player is now a plugin and (btw. 1.1.6 is out, too...:-)
    Anyway, we will add that feature.
  • Joen Member
    Quick response, cheers. Yeah, these modifications were made just days prior to 1.1.6, and I'm already using 1.1.6 in another project. You guys are brilliant.

    So I figured I'd just post it here, in case you wanted to add it (because I'm that lazy), but it's great to know you'll pick it up. Thanks again.

    Ideas for future improvements to this would be to grab the FLV dimensions from the JPEG thumbnail, and add the backcolor, frontcolor, lightcolor and displayheight variables to a plugin options page or something like that.

    Again, beautiful beautiful work.
  • acrylian Administrator, Developer
    ideas for future improvements to this would be to grab the FLV dimensions from the JPEG thumbnail,
    I am not sure if that is a good idea, because not everybody will use exactyl the dimension of the video I would think.

    and add the backcolor, frontcolor, lightcolor and displayheight variables to a plugin options page or something like that.
    Well, backcolor, frontcolor, screencolor and lightcolor are already in the 1.1.6 plugin...:-)

    I have already a draft for a additional flv playlist plugin that uses displayheight/width (I guess you had that in mind, don't you?).
  • Joen Member
    Sounds like things are in mighty capable hands already. I'll just shut my yapper and send more mental respect your way. And no, I haven't thought about any new playlist features :)
  • acrylian Administrator, Developer
    Mighty capable hands...:-)) Feedback and ideas are always welcome. Anyway, the playlist feature will come..:-)
  • Joen, thanks so much for posting your code. The method I was using to achieve a preview image broke when I updated the version I was running and your code was easily add in place of mine.
  • acrylian Administrator, Developer
    FYI, the preview image feature is already in the nightly / svn version as is a new flv player playlist plugin.
Sign In or Register to comment.