forum.coppermine-gallery.net

Support => cpg1.3.x Support => Older/other versions => cpg1.3 Themes/Skins/Templates => Topic started by: losparasitos on February 01, 2005, 04:37:06 pm

Title: [HELP] I want to play bgsound in specific Gallery`s
Post by: losparasitos on February 01, 2005, 04:37:06 pm
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-->
Code: [Select]
<!-- 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
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: Tranz on February 01, 2005, 08:30:34 pm
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.
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: losparasitos on February 01, 2005, 09:55:44 pm
ohh sorry for posting in the wrong board, I use the Coppermine Photo Gallery v1.3.2 hope somebody can help me
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: kegobeer on February 01, 2005, 10:30:57 pm
@Tranz: I moved this post from the features request board to this board, as this is more or less a theme issue.
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: losparasitos on February 03, 2005, 11:21:09 am
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!.
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: hama on February 03, 2005, 03:09:40 pm

@losparasitos

Music for your site:

--> http://forum.coppermine-gallery.net/index.php?topic=11106.0

Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: losparasitos on February 03, 2005, 05:40:23 pm
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........
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: kegobeer on February 03, 2005, 07:49:53 pm
This should work:

Open up init.inc.php and find
Code: [Select]
require 'include/media.functions.inc.php';
Above, insert
Code: [Select]
$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
Code: [Select]
pageheader(isset($CURRENT_ALBUM_DATA) ? $CURRENT_ALBUM_DATA['title'] : $lang_meta_album_names[$album]);
Replace that with this:
Code: [Select]
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
Code: [Select]
pageheader($album_name . '/' . $picture_title, $meta_keywords, false);
Above, insert
Code: [Select]
   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.
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: kegobeer on February 03, 2005, 11:40:08 pm
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.
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: losparasitos on February 04, 2005, 10:52:59 am
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.
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: losparasitos on February 04, 2005, 01:54:22 pm
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:
Code: [Select]
        }

        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
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: losparasitos on February 04, 2005, 03:18:50 pm
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!!!
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: kegobeer on February 04, 2005, 04:13:34 pm
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
Code: [Select]
'<embed src="' . $CONFIG['soundarray'][$album] . '" autostart="true" loop="true" hidden="true" height="0" width="0">';to
Code: [Select]
$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.
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: losparasitos on February 04, 2005, 05:02:36 pm
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)

Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: kegobeer on February 05, 2005, 03:29:11 am
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

Code: [Select]
pageheader($lang_display_image_php['slideshow']);
with

Code: [Select]
    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.
Title: Re: [HELP] I want to play bgsound in specific Gallery`s
Post by: losparasitos on April 22, 2005, 03:00:49 am
@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.