Homepage random image

cryptologer / 2011-08-26 13:07:48   

Hi,

I'm looking for a solution in order to have on my homepage a random slideshow of all my images uploaded on the web site, not a brackground image just an image (the usefull thread dedicated to this issue doesn't work anymore).
I used Random Background Plugin, as written in the previouses threads, but each refresh changes the size of the images and it's impossible to change the position of the background.
How could I have a result like this: http://www.diegolevy.com/
It took me two days and I didn't find a solution. Somebody could help me?. Thx.

pernin / 2011-08-26 13:15:45   

diegolevy.com changes the sizes too: it's dependent on the images' original sizes. what is your website? please read the forum rules

cryptologer / 2011-08-27 04:07:33   

my website is gildaaloisi.com.
thanks pernin.

pernin / 2011-08-27 05:24:22   

you have an error in your mailto, you need to close all your tags like this: </a></font></p>

because of this, the font tag is carrying over to the next element in the page container

have you checked that all your images are the same dimensions? i think that's what causing the size changes

there are several more errors in that page that may or may not be affecting what you want to do, you validate your page. you can do that here: http://www.w3schools.com/ there's a validator at the bottom

cryptologer / 2011-08-27 05:51:17   

I corrected the error in mailto, I missed to put .
And I checked the dimensions of all images: the same!
I found the validate bottom but I don't understand which page I have to validate and how can I do it.
Could a script in the plugin also cause the size changes?

pernin / 2011-08-27 05:58:18   

you can validate all your pages if you wish, but the important one is the main page, where you have the random bg, so that we can eliminate this from all the possible errors

cryptologer / 2011-08-27 06:15:48   

so the index.php in the template?
But i didn't understand how can I practically validate it?
Should I put this url: http://www.gildaaloisi.com/ndxz-studio/site/theme_01/index.php in the css validate bottom in this page: http://www.w3schools.com/web/web_validate.asp ?

cryptologer / 2011-08-27 06:25:53   

Sorry I putted the url of the main page on the box of html validate bottom and it found me the errors. But I dont' understand which file I have to correct on my server.

pernin / 2011-08-27 08:15:45   

that's ok, I see the few errors left are not affecting things

now's about tyhe random background: it's changing sizes because it's randomly using normal images and sometimes using thumbnails... shouldn't be doing that

what plugin are you using? I guess this may be an early version and there should be an updated one. do you remember where did you download it?

cryptologer / 2011-08-27 08:22:57   

from here: http://www.indexhibit.org/download/
it was released June 6, 2007
thx

cryptologer / 2011-08-27 09:14:05   

this is the code of my hompega randome image plug in:

cryptologer / 2011-08-27 09:14:20   
  1. <?php

/**
* Random Background
* For main page only
*
* Plugin
*
* @version 1.0
* @author Vaska
*/

// folder must be from the root of your Indexhibit site.
// If you are up more than one folder level indicate as 'folder/folder2'
// no beginning or trailing slashes /

function ndxz_rand_bg($folder='', $tile=false)
{
    global $rs;
    
    if ($rs['url'] == '/')
    {
        // get our images
        $path = DIRNAME . "/$folder/";
        
        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);
        
        $show = BASEURL . "/$folder/" . $images[$rand];
        
        $tile = ($tile == false) ? 'repeat' : 'no-repeat';
        
        // this 215px setting may need to be adjusted if you have altered your Index in the template
        $style = "body { background: url($show) $tile;nbackground-position: 215px 0;}n";
        

        return $style;
    }
    else
    {
        return backgrounder($rs['color'], $rs['bgimg'], $rs['tiling']);
    }
    
    return;
}

?>

pernin / 2011-08-27 10:16:37   

the plugin is ok, you need to do two other things:

create a folder for your background images, for example in your files folder: files/bg_images
upload the images you want into that folder

edit the sample/index.php, where you see the line that begins:
pernin / 2011-08-27 10:19:21   

oops...
where you see the line that begins:
<!-- <plug:backgrounder color='<%col etc.
replace it with:
<plug:ndxz_rand_bg 'files/bg_images', false />

that's all

cryptologer / 2011-08-27 16:35:21   

Great. It works! Thx pernin
Last question: how can align the bg image to the top menu on the left (Gilda Louise Aloisi) in the main page?
the website is: gildaaloisi.com

pernin / 2011-08-28 02:59:13   

you need to edit your plugin.ndxz_rand_bg.php, this line:
        $style = "<style type='text/css'>body { background: url($show) $tile;nbackground-position: 215px 0; }</style>n";

and adjust the background-position, 215px is horizontal from left and 0 is vertical from top. You can also specify values in %: 100% 100% is left bottom. Remember: if you specify a value different from 0 you have to specify either px or %

you can find more in: http://www.w3schools.com/

cryptologer / 2011-08-28 04:07:39   

Perfect! Thx thx

carloscarbonell / 2014-02-28 01:30:35   

Hello...

I need a little more help with this issue.

on my page carloscarbonell.com

i have the old version of Indexhibit.

But now I´m uploading a new site....
miguelnorato.com

I need to use the same plugin for the home background... random image..

How can I use that on the new site?

Thanks

This thread has been closed, thank you.