how can I use the random image module on my homepage?

stordyr

Joined: 2006-10-02
Posts: 6
Posted: Mon, 2006-10-02 20:49

Hello,

i use gallery2 and i like this "random Image" module... I'd like to have it on my content page but i'm not really fit with php ;)
i can add of course content to my php-site and it would be so cool if i could use the random image there...

who can help me?

so Long

Stordyr

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25940
Posted: Mon, 2006-10-02 21:06

There is directions on the image block module.
Site admin > image block.

Basicly you paste the code from the imageblock module admin page into your other page eg:
<?php @readfile('http://example.com/gallery2/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>
Is the "other page" php?
If not then you can try an iframe

Dave

 
stordyr

Joined: 2006-10-02
Posts: 6
Posted: Mon, 2006-10-02 21:25

yes it's a custom php-file made by a friend of mine who has not much time these days :(

it's somehow like this:

Quote:
<?
content(230,"Links",'some content here');
?>
<?php @readfile('http://example.com/gallery2/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>
<?
content(230,"Toplists",'some content here');
?>

i tried it this way and nothing happens ;)

so Long

Stordyr

 
hollyonline

Joined: 2006-09-13
Posts: 59
Posted: Mon, 2006-10-02 22:40

Providing you put the imageblock php tag described above in your homepage and use appropriate tags to begin and end (php doesn't like white space after final closing tag by the way) you should be fine. Works ok here: http://www.oceanrealmimages.com/intro.php

rob

---
Robert Hollingworth
www.roberthollingworth.co.uk

 
stordyr

Joined: 2006-10-02
Posts: 6
Posted: Tue, 2006-10-03 11:02

Hello...

we managed it to display a random image within a custom style block...
Thank you so far for the help

now we have two smaller problems...
the image has a frame and we are not able to remove it... we tried
itemframe and albumframe with 0 and none but no effect...
and there is an ID displayed which a want to be removed... we removed the name allready but the ID stays displayed...

has anyone an idea?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25940
Posted: Tue, 2006-10-03 13:05

url?

 
stordyr

Joined: 2006-10-02
Posts: 6
Posted: Tue, 2006-10-03 14:11

Oh yeah... i forgot

www.celea.de :)

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25940
Posted: Tue, 2006-10-03 22:04
stordyr wrote:
now we have two smaller problems...
the image has a frame and we are not able to remove it... we tried
itemframe and albumframe with 0 and none but no effect...
and there is an ID displayed which a want to be removed... we removed the name allready but the ID stays displayed...

has anyone an idea?

It is not a image frame it is a border that is added to all images that are links
add

img
{  border-style: none;
}

to your css on you main page.

Dave
____________________________________________________
Blog with G2 || Gallery Frames / Mods || G1 Test Gallery

 
stordyr

Joined: 2006-10-02
Posts: 6
Posted: Wed, 2006-10-04 14:08

ok... i instructed my webmaster to do this.. but what about those ID-Numbers that come with the image. Is there a way to make them disapear?

regards

Stordyr

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25940
Posted: Thu, 2006-10-05 00:45
 
stordyr

Joined: 2006-10-02
Posts: 6
Posted: Thu, 2006-10-05 14:29

Hi there...

we will test the link after work...
thank you very much for this.

one question about your suggestion with this stylesheet. The border comes from a stylesheet within gallery2 if i get it right? Which one could that be? Our webmaster didn't found the right one he said...

regards

Stordyr

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25940
Posted: Thu, 2006-10-05 19:05

Different browsers behave differently. If there is no border set for images that are links then the _default_ behavior in IE and FF are one px border the color of the links. So if it is not defined then you will have a order. The Image block does NOT send style info, so you will have to define in in the css the page uses.

Try for yourself ....add a image as a link on your page and you will see a 1px border.

Dave.

 
seaus

Joined: 2007-02-15
Posts: 24
Posted: Thu, 2007-03-01 06:44

Ok, I think this is almost perfect. Using your code from above I got the random image to show up on an independent page. I do not have a CSS file with that page. Can I get rid of the image border or the link all together? Also, can I loose the image title?

Here is where the sample page lives:
http://carlsonlandscapes.com/test.php

And here is the code I am using:
<?php
@readfile('http://carlsonlandscapes.com/gallery/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>

Thank you for your help

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25940
Posted: Thu, 2007-03-01 15:08

looks like you sorted the title out.

.one-image img{
border:none
}

in your css will get rid of the border.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
seaus

Joined: 2007-02-15
Posts: 24
Posted: Thu, 2007-03-01 15:11

Can I get rid of the link all together?

 
seaus

Joined: 2007-02-15
Posts: 24
Posted: Thu, 2007-03-01 15:13

The border trick now works in IE and Firefox. Thanks.

The only thing better would be to not have a link at all

http://www.carlsonlandscapes.com/index2.php

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25940
Posted: Thu, 2007-03-01 17:07

For no link try:
..... you will need a transparent .gif image:

<style type="text/css">
.one-image {
position: absolute;
top: 50px;
left: 100px;
}
</style>
<?php 
@readfile('http://EXAMPLE.com/gallery2/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); 
?>
<div class="one-image"><img src="http://EXAMPLE.com/images/pixel_trans.gif" width="200" height="200"></div>

You will need to position the <div> to where you would like or nest it in another <div>
Adjust the height and width (200 in the example) to your imageBlock size.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Marshall10488

Joined: 2007-03-09
Posts: 3
Posted: Fri, 2007-03-09 01:47

Is there a way to remove the title of the image, the blue border and make it smaller?
Thanks Ben

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25940
Posted: Fri, 2007-03-09 05:04

Did you read the thread?

floridave wrote:
looks like you sorted the title out.

.one-image img{
border:none
}

in your css will get rid of the border.

http://codex.gallery2.org/Gallery2:Modules:imageblock

_____________________________________________
Blog & G2 || floridave - Gallery Team

 
Marshall10488

Joined: 2007-03-09
Posts: 3
Posted: Fri, 2007-03-09 17:11

ive managed to resize the image and get rid of teh border thanks but how do i get rid of the text?
http://www.thesimplestsolution.co.uk/kites/index.phpthere is a link and the code im using is:
<style type="text/css">
.one-image img{
height:100px;
width:100px;
font-size:small;
border:none;

}
</style>
<center> <?php
@readfile('http://sucs.org/~kiteaholics/gallery2/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>

</center>

 
Marshall10488

Joined: 2007-03-09
Posts: 3
Posted: Fri, 2007-03-09 17:18

I've got it now thanks for your help. the code i used in the end is.
<style type="text/css">
.one-image img{
max-height:120px;
max-width:120px;
border:none;

}
</style>
<center> <?php
@readfile('http://sucs.org/~kiteaholics/gallery2/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none'); ?>

</center>

thanks again

 
Nghia

Joined: 2007-03-03
Posts: 8
Posted: Wed, 2007-03-14 19:07

Is it possible to add more than 1 image. For example 5 random pics?

 
floridave
floridave's picture

Joined: 2003-12-22
Posts: 25940
Posted: Thu, 2007-03-15 03:00

G2.2 has a confuration option for quantity.
older verions; just add the code over 5 times.

Dave
_____________________________________________
Blog & G2 || floridave - Gallery Team