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:
- Download ZenVideo-0.1. Extract the file player_flv.swf and put it into the zen directory of your zenphoto installation.
- 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.
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 ''.
''.
' '.
''.
''.
''.
''.
''.
'';
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
I've been offline for a long time...
So, i'm (really) gonna release zenvideo-0.2 with with support for most of the themes (including stopdesign).
I could include too the support of mp3... Using your code.
So the installation of this patch would be easier for everyone.
Would you mind if i use your code cvogt ?
Make this hack work properly in IE:
I experienced problems with the videos in IE and found a web page covering that problem.
I made some more changes, and the function printDefaultSizedImage() now looks like this:
`function printDefaultSizedImage($alt, $class=NULL, $id=NULL) {
// [BEGIN] added by cvogt: check for non image data
$file_full = $_SERVER['DOCUMENT_ROOT'].getFullImageURL();
$file_wo_ext = substr($file_full,0,strrpos($file_full,"."));
if( file_exists( $file_wo_ext.".flv" )){
echo '
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
width="640" height="480">
`
`
width="640" height="480" type="application/x-shockwave-flash">
FAIL (the browser should render some flash content, not this).
`
`'.
'';
return;
}
echo "
" width="" . getDefaultWidth() . "" height="" . getDefaultHeight() . """ .
(($class) ? " class="$class"" : "") .
(($id) ? " id="$id"" : "") . " />";
if( file_exists( $file_wo_ext.".mp3" )){
echo '';
echo '
codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,40,0"
width="290" height="24">
`
`
width="290" height="24" type="application/x-shockwave-flash">
FAIL (the browser should render some flash content, not this).
`
` '.
'';
return;
}
``
}`
Now it works properly .