Quick extension for mp3 and flv / Audio and Video for 1.0.3beta

I wanted to have mp3 and video working in zenphoto with minimal change from the original code. I took inspiration (and flv player and little code) from the post Support of videos for ZenPhoto.

Notice: You NEED to have a picture with the same name like the flv or mp3 in the album folder (eg. for albums/nice_sounds/beep.mp3 you also need albums/nice_sounds/beep.jpg). Otherwise it will not be shown in the album.

This is the way I got audio and video working:
  1. Download ZenVideo-0.1. Extract the file player_flv.swf and put it into the zen directory of your zenphoto installation.
  2. Download Audio Player Wordpress Plugin. Extract the player.swf, rename it to player_mp3.swf and again put it into the zen directory of your zenphoto installation.

  3. Modify the file template-functions.php of your zenphoto installation:

    Put the following code at the end of the function printDefaultSizedImage() (after line 868):
    ` if( file_exists( $file_wo_ext.".mp3" )){

    echo '';

    echo ''.

    ''.

    '
  4. '.
    ''.
    ''.
    ''.
    ''.
    ''.
    '';
    return;
    }`

    Furthermore put the following code just at the beginning of the same function (after line 863):
    ` $file_full = $_SERVER['DOCUMENT_ROOT'].getFullImageURL();
    $file_wo_ext = substr($file_full,0,strrpos($file_full,"."));
    if( file_exists( $file_wo_ext.".flv" )){
    echo ''.
    ''.
    ''.
    ''.
    ''.
    ''.
    '';
    return;
    }`


Notice: Read the notice at the top again!

Upload some mp3, flv and the belonging pictures and try it out. For more information how to create flv see the post Support of videos for ZenPhoto.

Comments

Sign In or Register to comment.