Forums » Customize

Random full background the lost php

  • Pages:
  • 1
  • 2
istott83
UNITED KINGDOM
2010-01-09 15:31:41
Permalink Post
 

Hi peeps,
I've read through the useful posts section... and it was very useful, i've managed to get my full background up 'n' running and various other bits and bobs.
I'm now looking to make my full background randomise each time your click home, which was solved in the 'useful posts' > 'full backgrounds' section here, but the links for the php coding were never fixed and i've tried to get my head around how he (sawatzki) did it, but i end up getting lost. i even tried looking into the supersize jquery, but still didn't get anywhere.
I tried animated gif's but it's a photo web, and the images are just too low quality from a gif.
I've learnt loads and am learning even more, but am totally stuck on this one, so any help would be muchly appreciated!
Thanks Legends!!
my home

istott83
UNITED KINGDOM
2010-01-11 00:36:13
Permalink Post
 

so, i've worked really hard and got this far...
i can make the full background randomise, but i need it to be over-ridden if there's an image selected in the exhibit cms. i've searched for 'if... else...' php tutorials, but whenever i do it, i get an issue with an 'unexpected T else' or an issue with $end.

here's my hashing together of various bits 'n' bobs (apologies, i'm a bumbling noob!)

  1. <?php
  2. function random_full_background$folder'files/homepage_pix' $altfalse $idfalse $classfalse $titlefalse 
  3.         
  4.         global $rs
  5.         $path  DIRNAME  "/files/homepage_pix/"
  6.          if is_dir$path
  7.         
  8.             if $fp  opendir$path 
  9.             
  10.                 while $module  readdir$fp !== false 
  11.                 
  12.                     if eregi"jpg$" $module || eregi"gif$" $module || eregi"png$" $module
  13.                           
  14.                         $images  $module
  15.                     
  16.                  
  17.             
  18.             closedir$fp
  19.         
  20.         $image  count$images
  21.         $rand  rand0 $image1
  22.         $url  BASEURL  "/files/homepage_pix/"  $images$rand
  23.         return <img src='$url' width='$size0' height='$size1' alt='' />
  24.     return
  25. ?>
  26. and here's what i thought it should be to randomise the full background 
  27. <?php
  28. function random_full_background$folder'files/homepage_pix' $altfalse $idfalse $classfalse $titlefalse 

    
     global $rs;
if ($rs['bgimg'] != '') {
// get the dimensions
$size = getimagesize(DIRNAME . '/files/' . $rs['bgimg']);
return "";
}
return;
}
    else
        
{        global $rs;
        $path = DIRNAME . "/files/homepage_pix/";
         if (is_dir($path))
        {
            if ($fp = opendir($path))
            {
                while (($module = readdir($fp)) !== false)
                {
                    if ((eregi("jpg$", $module)) || (eregi("gif$", $module)) || (eregi("png$", $module)))
                    {
                        $images[] = $module;
                    }
                }
            }
            closedir($fp);
        }
        $image = count($images);
        $rand = rand(0, $image-1);
        $url = BASEURL . "/files/homepage_pix/" . $images[$rand];
        return " ";
    return;
}
?>

istott83
UNITED KINGDOM
2010-01-11 00:36:55
Permalink Post
 

sorry it's all a bit messed up, as previously mentioned.. i'm no pro:)

istott83
UNITED KINGDOM
2010-01-11 00:52:03
Permalink Post
 

i just did it. chuffed to bits with myself:)

i have the code, totally willing to share, but i can't write it without it wanting to do crazy stuff... how do i make it download-able!?

arsondpi A
GREECE
2010-01-11 14:05:14
Permalink Post
 

...upload it in a shared server (or your own server) and type a link here...
Thx for sharing btw!

istott83
UNITED KINGDOM
2010-01-11 15:57:00
Permalink Post
 

here's the link:)

plugin.random_full_background.php

you need to call this in your index.php using this:

  1.  plug:random_full_background  

put it after it's called the info about 'the-background' (where the full_background plugin was called)

MASSIVE thank you to arsondpi, lots was learnt from you!

istott83
UNITED KINGDOM
2010-01-11 16:00:16
Permalink Post
 

oh and you'll need to change some bit's where it's directing to get the images from, my file was called 'homepage_pix' just change that bit to whatever you call you file full of images to be selected randomly.

m12059
GERMANY
2010-01-11 16:28:32
Permalink Post
 

cannot download the file at dropbox. 403 error!
can you correct this?
muchas gracias!

istott83
UNITED KINGDOM
2010-01-11 18:00:09
Permalink Post
 

weird, sorry bud, try just clicking the link, copying all the text and then sticking it into a new php, calling it random_full_background.php and saving it to your plugins folder:)
hope this helps

benhorinb
UNITED STATES
2010-01-11 18:22:17
Permalink Post
 

@istott83 - your link is not working...

istott83
UNITED KINGDOM
2010-01-11 18:41:46
Permalink Post
 

try this:
randomfullbackground

istott83
UNITED KINGDOM
2010-01-11 18:42:22
Permalink Post
 

sorry m12059 and benhorinb!

benhorinb
UNITED STATES
2010-01-11 20:05:34
Permalink Post
 

nope... i think you perhaps have to make the file public or something...

istott83
UNITED KINGDOM
2010-01-11 20:45:39
Permalink Post
 

wow, really sorry ben, ok try this
http://www.box.net/shared/4k2vnah2y1

istott83
UNITED KINGDOM
2010-01-11 20:46:06
Permalink Post
 

sorry,

this

istott83
UNITED KINGDOM
2010-01-11 21:31:12
Permalink Post
 

hi could someone please delete my fumbled links until this last one:) thank you!

lemathieu A
FRANCE
2010-01-11 23:30:55
Permalink Post
 

No, funnier like that !

;)

benhorinb
UNITED STATES
2010-01-12 08:22:48
Permalink Post
 

thank you istott83, and sorry for the hassle.
i have an idea i want to try and build on top of that, if it works i will post it back here...
thanks again.

matthewoliver
FRANCE
2010-01-26 10:19:15
Permalink Post
 

I've just installed the plugin, except the homepage isn't randomized, but the different exhibitions are... This is quite the mess, as my exhibitions are photo galleries...
Any thoughts?

matthewoliver
FRANCE
2010-01-26 15:54:30
Permalink Post
 

I've managed to get the homepage randomized, and having plain white background exhibitions.
My problem now, is that my randomized images have a weird size... I've trying uploading different photo sizes (640x426, 800x533 and 1024x682) but the images still get cropped.
I've looked in the css, it says 100% width and 100% height.
What am I missing?

handbuilt
UNITED STATES
2010-02-02 03:43:24
Permalink Post
 

Thank you so much for this. It seems to work for my main page but I can't understand what happens elsewhere: two images get superimposed.
http://graphics320.com/broodwork/index.php?/projects/participants/

handbuilt
UNITED STATES
2010-02-02 16:54:25
Permalink Post
 

If someone could take a look, I would greatly appreciate any advice.
http://graphics320.com/broodwork/index.php?/projects/participants/

handbuilt
UNITED STATES
2010-02-03 01:08:46
Permalink Post
 

I resolved it. Thank you.

matthewoliver
FRANCE
2010-02-12 09:43:32
Permalink Post
 

Hi,

I've installed the plugin, it works as advertised, thanks istott83!

  1. I have just one problem, I would like my images to start left of the menu (meaning background-position: 215px), except I can't do it through CSS, it has to be done via the plugin. I've tried several things like adding this line: 
  2. $style = "body { background: url($show) $tile;nbackground-position: 215px 0; }n";
  3. But it doesn't do anything...

Can someone help?

Thanks,

Matthew

Matthew Oliver Photography

verena
GERMANY
2010-02-12 16:07:50
Permalink Post
 

Hi,

I've got a problem... I put the

plugin.random_full_background.php

of istott83 into the plugin folder on my server and then changed my index php. That's probably the point where I messed it up. it looks like this:

  1. /script>
  2. plug:front_dyn_js />
  3. plug:backgrounder color='<%color%>', img='<%randombg%>', tile='<%tiling%>' />
  4. plug:random_full_background img='<%randombg%>', tile='<%tiling%>' />
  5. /head>

(The folder with the pictures I want to use is called 'randombg'.)
Can anyone tell, what's wrong here? Is it because I'm calling two plugins? Or is it even the wrong place?
Before I discovered the random background image I installed successfully the random exhibits plugin. Are they messing up each other?
Sorry for maybe stupid questions, I'm trying to get through this coding stuff...

Thanks in advance for a helpful advice.
V.

my site under construction

matthewoliver
FRANCE
2010-02-12 16:42:27
Permalink Post
 

Did you remember to change the folder name containing the pictures in the plugin? /files/homepage_pix/ => randombg

verena
GERMANY
2010-02-12 16:56:49
Permalink Post
 

Hi matthewoliver,

thanks for your quick answer. You were right, that's what I forgot... I now corrected it:

$url = BASEURL . "/randombg/" . $images[$rand];

but it's still not working...

Maybe it's still the index.php??

V.

matthewoliver
FRANCE
2010-02-12 17:15:47
Permalink Post
 

Yes, you might want to comment the plugins you are not using.

verena
GERMANY
2010-02-12 18:16:39
Permalink Post
 

Hm.. I have no idea how to do that. Just comment them out? The code part in my index.php looks like this:

  1. /script>
  2. plug:front_dyn_js />
  3. plug:backgrounder color='<%color%>', img='<%randombg%>', tile='<%tiling%>' />
  4. plug:random_full_background img='<%randombg%>', tile='<%tiling%>' />
  5. /head>

I saw arsondpis tutorial on how to install the full background image (not the 'random background image' though).He also has a 'full_background.js' besides the php file. Do I have to install this, too?

Thanks for your help!
V.

matthewoliver
FRANCE
2010-02-12 19:33:28
Permalink Post
 
verena
GERMANY
2010-02-13 16:54:10
Permalink Post
 

Hi matthewoliver,
there was no text in your reply (or I couldn't see it...). Would you mind posting it again?

V.

matthewoliver
FRANCE
2010-02-16 12:39:38
Permalink Post
 

Oh sorry. You have to comment out the plugin you're not using.

djuve
NORWAY
2010-02-17 13:25:15
Permalink Post
 

Hi everyone,
I have succesfully installed this plugin (thank you istott83) and after some fiddling around everything works as I want, EXCEPT one thing: My fullscreen image seems to have a 15px margin on the right side, which is really annoying. I guess something in my CSS is messing things up, but I have tried unsuccesfully to find the culprit. It might also be because I put the plugin in the exhibit instead of in the index file, in order to restrict the random background to the main page only...

The weird thing is that
1. There is no annoying margin in Safari, only in Firefox (haven't tested other browsers)
2. The margin disappears instantly when I start to resize my browser window, then reappears when i refresh the page again

Here's the problem page: Webpage

Would really appreciate it if you gurus had a look at it. Maybe it's an easy fix?

lemathieu A
FRANCE
2010-02-17 14:01:19
Permalink Post
 

No margin in FF on mac on the right, it's… on the bottom.

matthewoliver
FRANCE
2010-02-17 14:02:22
Permalink Post
 

I'm on a mac and using both safari and firefox, I don't see a margin. It's all good to me.

richardn
UNITED KINGDOM
2010-02-17 14:21:45
Permalink Post
 

I'm on a mac and I see a margin in both safari and firefox. The margin can be at the bottom or the right, depending on how the browser window is sized when the page loads (narrow window gives a bottom margin, wide window gives a right margin).

verena
GERMANY
2010-02-17 15:05:17
Permalink Post
 

Hi,
I'm still struggling with the random full background php.
I've been through several threads twice, I installed it twice, also with arsondpis tutorial, but there is still no background image showing up...

What I did:
-got istotts random full background php file, changed the name of istotts images folder to the name of my background image folder

-uploaded the php file of istott to my ftp server, renamed it from
plugin.random_full_background.php to
random_full_background.php

-uploaded a folder with the background images called 'randombg'

-added "plug:random_full_background" to the index.php

-uploaded the full_background.js from arsondpis tutorial to the js folder, updated my jquery

I would be very glad if someone could have a glimpse at my site and maybe tell me where I got stuck.

T h a n k s!!
V.

the randomfullbackground refusing page

djuve
NORWAY
2010-02-17 15:25:50
Permalink Post
 

Thanks for the replys, guys!

Hmmm... So lemathieu has a bottom margin, matthewoliver has no margins and richardn has both bottom and/or right margins? This is strange, why is it varying? I don't get it.

@verena: I don't think you should've renamed the plugin, it should be called "plugin.random_full_background.php". If you have added

  1. < plug:random_full_background />

to your index then it should work, can't see any other faults on your page.

richardn
UNITED KINGDOM
2010-02-17 18:11:07
Permalink Post
 
This is strange, why is it varying? I don't get it.

Like I said, I think it depends on how the user has sized their browser window.

verena
GERMANY
2010-02-18 16:49:35
Permalink Post
 

@djuve: thanks, that was the solution, you made my day yesterday!

So I got the random background plugin to work but still have 2 problems:

- the background image is repeating on all exhibits, I only wanted it on the main page

- the image isn't resizing to the screen size

What am I doing wrong? I've been through the fullbackground thread again, but didn't find the answer there (my jquery is updated).

Anyone with a helpful look on my site?
Thanks in advance.
V.

Webpage

djuve
NORWAY
2010-02-18 18:41:45
Permalink Post
 

@verena:

- to limit the background image to the main page, you can call the plugin from your main page exhibiton (text area) instead of in the index file. At least that's what I did, maybe there's better solutions. Of course, I then got a problem with the background going on top of everything else, blocking the menu. I solved that with manipulating some wrappers and z-indexes in my CSS. Don't ask me how, I lost track of how I did it...

- don't know how to fix the resizing, looks like you might have a similar problem like me

verena
GERMANY
2010-02-18 19:16:55
Permalink Post
 

Hi djuve, thanks for your help.

I tried this but unfortunately it doesn't work like on your and on other websites... I get a white background in my exhibits now but then the background on the first page is messed up. I changed my css styles back and forth with code I got via firebug from other sites where it's working, but no success.

And a third question is coming up: What can I do to have my menu stay fixed when I scroll down in my exhibits? I also tried some variations with my css but I don't get it.

Puhh.
Any suggestions??

Thanks!
V.

Webpage

richardn
UNITED KINGDOM
2010-02-18 20:42:19
Permalink Post
 
What can I do to have my menu stay fixed when I scroll down in my exhibits?

Change the #menu css back to {position: fixed}

verena
GERMANY
2010-02-19 10:04:35
Permalink Post
 

yeah great!! it work's!! thanks, richardn.

Do you have such a helpful advice for my strange background image?? It doesn't start top left, but somewhere in the middle and it's not resizing. I called the plugin from the text area in my home exhibit instead of the index.php, like djuve told me, otherwise it was on all exhibits.

Any ideas?
Thanks in advance.
V.

Webpage

verena
GERMANY
2010-02-19 12:33:29
Permalink Post
 

Anyone??

djuve
NORWAY
2010-02-19 13:14:03
Permalink Post
 

Try to put the plugin in a div, like this:

  1. < div id='the-background' >< plug:random_full_background />< /div >

That might work, because you've already styled #the-background in your stylesheet to start top left and fill the screen.

verena
GERMANY
2010-02-19 14:38:48
Permalink Post
 

I tried this both in my exhibit text area and in the index.php file. There is no change.

When I put the following code in my index.php, the images at least start top left, so isn't there a way to tell the plugin to stay off the other exhibits?

  1. plug:front_dyn_js />
  2. plug:backgrounder color='<%color%>', tile='<%tiling%>' />
  3. script type='text/javascript' src='<%baseurl%><%basename%>/site/js/full_background.js'></script>
  4. plug:random_full_background />

Thanks again.
V.

verena
GERMANY
2010-02-19 19:29:45
Permalink Post
 

Hey guys,
thanks for the support so far, but I wouldn't ask again if I could solve the problem myself... I've been through several threads again, but I just can't figure out:

- how to have the background image only on the main page and not on all my exhibits

- how to make the images resize to the screen size.

I'm struggling with this for two days now, I'm pretty much at a loss.

I would be very thankful for some help.
Thanks again.
V.

the chaos page

verena
GERMANY
2010-02-20 10:02:03
Permalink Post
 

I really feel bad, posting permanently... Any help maybe on this sunny saturday morning??

V.

verena
GERMANY
2010-02-20 10:47:50
Permalink Post
 

ok. I'll turn the full background off for now. Thanks for support so far though.
V.

Showing 1 - 50 of 97 posts in Forum > Customize > Random full background the lost php
 
  • Pages:
  • 1
  • 2