[HELP] I want to play bgsound in specific Gallery`s [HELP] I want to play bgsound in specific Gallery`s
 

News:

cpg1.5.48 Security release - upgrade mandatory!
The Coppermine development team is releasing a security update for Coppermine in order to counter a recently discovered vulnerability. It is important that all users who run version cpg1.5.46 or older update to this latest version as soon as possible.
[more]

Main Menu

[HELP] I want to play bgsound in specific Gallery`s

Started by losparasitos, February 01, 2005, 04:37:06 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

losparasitos

Hello, I really like Coppermine but there is one thing I`am really missing: I want to be able to play different background sounds for different galleries. ../thumbnails.php?album=1 should play song1 and ../thumbnails.php?album=2 should play song2 but I don`t have a clou how to manage this and fear that this can`t be done without dB work. I said fear coz I cant`t prog PHP and mySQL, anyway maybe this piece of Code can do the job but I don`t know where to place it.....

from selfhtml--><!-- Microsoft: -->
<bgsound src="background.mid" loop="infinite">
</head>
<body>
<!-- Netscape: -->
<embed src="background.mid" autostart="true" loop="true" hidden="true" height="0" width="0">


I hope someone of you has a solution thx4 any help

Tranz

It looks like you are looking for support, not a request for future versions, which I doubt will implement background music. Please specify your version so I can move this to the correct support board. Thanks.

losparasitos

ohh sorry for posting in the wrong board, I use the Coppermine Photo Gallery v1.3.2 hope somebody can help me

kegobeer

@Tranz: I moved this post from the features request board to this board, as this is more or less a theme issue.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

losparasitos

Hi, I took a look inside the theme.php (igames) but couldn`t find anything where I could integrate the needed code. It might be that I can`t find anything because Iam a total PHP newbie please help out if you can THX very much!.

hama

Get up, stand up, stand up for your rights! - Get up, stand up, don't give up the fight!

losparasitos

thx hama I`ve read that topic twice but it does not help me, more interesting for me is this topic: http://forum.coppermine-gallery.net/index.php?topic=2577.0 but it looks like when I would use the mentioned code that one mp3 is playin on ALL Slideshows I need different mp3`s for different Album`s........

kegobeer

#7
This should work:

Open up init.inc.php and find
require 'include/media.functions.inc.php';

Above, insert
$CONFIG['soundarray'][1] = "albmusic/Crawling.mid";
$CONFIG['soundarray'][2] = "albmusic/mysound2.mid";
$CONFIG['soundarray'][3] = "albmusic/mysound3.mid";


Change the array numbers to match the album numbers in your gallery.  Change the sounds to whatever midi files you want.  If you have albums numbered 1, 5, and 6, you would have [1] = "yoursound", [5] = "yoursound", [6] = "yoursound".  I created a directory called albmusic in my root Coppermine directory and put the music there.

Open up thumbnails.php and find
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);

Replace that with this:
if ($CONFIG['soundarray'][$album]) {
   $meta_keywords = '<embed src="' . $CONFIG['soundarray'][$album] . '" autostart="true" loop="true" hidden="true" height="0" width="0">';
}
$first = isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album];
pageheader($first, $meta_keywords);


This will play music while you are in the main album page.  When you are viewing pictures you won't get music.  If you want music while viewing the pictures:

Open up displayimage.php and find
pageheader($album_name . '/' . $picture_title, $meta_keywords, false);

Above, insert
   if ($CONFIG['soundarray'][$album]) {
       $meta_keywords .= '<embed src="' . $CONFIG['soundarray'][$album] . '" autostart="true" loop="true" hidden="true" height="0" width="0">';
   }


You will now have music for your albums.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

kegobeer

Bear in mind that background music, especially stuff forced on the visitor, is really annoying.  You may find your visitors/members asking you to remove this.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

losparasitos

thx kegobeer!!!, I know what you mean by annoying stuff for users but I want to use it only in some albums where it will fit and iam sure my users will like that feature again thank you very much. I will integrate this feature now in a testgal and l8er i will put into my livegal.

losparasitos

Hi its me again, I changed the files with the Code you mentioned. It works fine for the displayimage.php part but the part in thumbnails.php does not work for me, my thumbnails.php now looks like this:
        }

        breadcrumb($cat, $breadcrumb, $breadcrumb_text);
    }
}

**********************************************kegobeer********************************************************************
if ($CONFIG['soundarray'][$album]) {
    '<embed src="' . $CONFIG['soundarray'][$album] . '" autostart="true" loop="true" hidden="true" height="0" width="0">';
}
$first = isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album];
pageheader($first, $meta_keywords);
**********************************************kegobeer*********************************************************************

if ($breadcrumb) {
  if(!(strpos($CONFIG['main_page_layout'],"breadcrumb")===false)){
            theme_display_breadcrumb($breadcrumb, $cat_data);
        }


Hope you can help me fixing it!
Here is a link to the Album where I added sound: http://portal.laubenban.de/gallery/thumbnails.php?album=2 if you click a picture it will play the sound

losparasitos

Hmmm I found out that when you change the picture the sound will restart from the beginning, maybe it is a good idea to use the bgsound ONLY in the slideshow function because the slideshow will just load one time so the song can play in full lenght(~4min) and loop then. I think for that the slideshow.inc.php has to be edited instead of the init.inc.php but the code should be nearly the same, iam not sure howto because iam a bloody-noob.

Kegobeer how does your code work on the main album page (thumbnails.php) does the song stop to play when I open a picture and restarts when I re-enter the main album page? - If so I need different songs playing in different slideshows..... Sorry for all my nOOb questions and thoughts and thx for your help!!!

kegobeer

That's a limitation of <bgsound> and <embed> - everytime you refresh the page, the music starts from the beginning.  Without using frames, you'd have to open up some sort of music player in a pop up window that would allow a selection of music for your visitors.  I remember seeing these a few years back, when they were all the rage.

For your other issue, change
'<embed src="' . $CONFIG['soundarray'][$album] . '" autostart="true" loop="true" hidden="true" height="0" width="0">';
to
$meta_keywords = '<embed src="' . $CONFIG['soundarray'][$album] . '" autostart="true" loop="true" hidden="true" height="0" width="0">';

I edited my earlier post to reflect this change.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

losparasitos

Well done and thank you very much kegobeer, now I begin to understand that other topic where ppl use the iframe. What do you think if the slideshow plays embedded sound it just load one time (and the song will play full lenght and loop then) or won`t it???.

My last question would be if my statement bout the slideshow is true: "could you code it for me?, this would be really my last question bout this topic. Anyway you already helped me a lot and I must say thx and very very nice support. (I will be offline somedays, so don`t be in a hurry)


kegobeer

You want background music during the slideshow?  Easy enough.

Undo all the changes except for the init.inc.php file changes.

Open displayimage.php and find function slideshow().  Replace

pageheader($lang_display_image_php['slideshow']);

with

    if ($CONFIG['soundarray'][$HTTP_GET_VARS['album']]) {
        $meta_keywords .= '<embed src="'.$CONFIG['soundarray'][$HTTP_GET_VARS['album']] . '" autostart="true" loop="true" hidden="true" height="0" width="0">';
    }
   
    pageheader($lang_display_image_php['slideshow'], $meta_keywords);


You now have a repeating background sound while viewing a slideshow for your specific album.
Do not send me a private message unless I ask for one.  Make your post public so everyone can benefit.

There are no stupid questions
But there are a LOT of inquisitive idiots

losparasitos

@keego:
You are the best thx4help, it worx just perfect sorry that I didn`t post earlier. As I told iam travelling a lot and don`t have Internetaccess then.