View Full Version : Random Pictures Module
ogetbilo
05-27-2004, 12:39 PM
I ported the 'Feature Pic/ Babe of The day/ Intergration all in 1' hack to vB CMPS with the permission of the author.
All the credits go to Amavisca (aka: Eclipse at Speedyks.com)
This module takes a random picture from a folder in your server where you store your pictures, resizes and displays it in a smallbox in your CMPS home page.
Instructions:
1) Copy the attached refresh.php file inside the folder where your pictures are.
2) Create a template with name 'adv_portal_images' (without the quotes) with the contents:
<table align="center" border="0" cellpadding="$stylevar[cellpadding]" cellspacing="$stylevar[cellspacing]" class="tborder" width="100%">
<tr>
<td class="tcat"><span class="smallfont"><b>$vboptions[blockbullet] Image</b></span></td>
</tr>
<tr><td align="center">
<img src="$vboptions[homeurl]/path/to/your/images/folder/refresh.php" width="150" border="0">
</td>
</tr>
</table>
<br />
*Modify the path/to/your/images/folder to the folder where your images are.
**You can play with the width setting. I tried to do it with "100%" but Internet Exploder causes problems with that (works fine with mozilla though?)
3) Create a module with:
Module Title: Images
Template to include: images
set the display order and column according to taste and SAVE
That's All!:)
Preech
05-29-2004, 11:37 AM
Can we also make this so people won't steal images, or bandwidth.
adhari_com
05-29-2004, 12:23 PM
Nice and thanx alot, but a suggestion that u'd do a module to randomly pick up an attachment image and display it?
peace.
ogetbilo
05-29-2004, 02:23 PM
Can we also make this so people won't steal images, or bandwidth.
You can make the module such that only subscribed users can see the picture. alternatively, you can put a plank html page to your images folder to prevent users browsing that folder.
Nice and thanx alot, but a suggestion that u'd do a module to randomly pick up an attachment image and display it?
peace.
I will work on this. :)
quasan
06-06-2004, 09:27 PM
hi,
i like this one very much, but my problem is, that I want to click the pic and than it should appear in the original size.
TYorke
06-06-2004, 11:26 PM
hi,
i like this one very much, but my problem is, that I want to click the pic and than it should appear in the original size.
Maybe a little HTML magic?
<a href="$vboptions[homeurl]/path/to/your/images/folder/refresh.php" target="_blank"><img src="$vboptions[homeurl]/path/to/your/images/folder/refresh.php" width="150" border="0"></a>
I haven't tested it, but that *could* work :)
quasan
06-07-2004, 12:04 AM
nop that doesn't work .
when you call the refreshscript it will randomly choose a picture...
so if you display the module.. it is p.e picture1.jpg...
when you click the link, the refresh script is called again and it will choose randomly any other pic...
mholtum
06-07-2004, 05:01 AM
I get a red X hmm
http://www.ravensrealm.net
ogetbilo
06-09-2004, 01:00 PM
nop that doesn't work .
when you call the refreshscript it will randomly choose a picture...
so if you display the module.. it is p.e picture1.jpg...
when you click the link, the refresh script is called again and it will choose randomly any other pic...
hmm, I'm not sure that there is a way of calling the same picture once more without storing any data in database.
quasan
06-09-2004, 02:09 PM
yep with this refresh.php there is no way to do it:(
perhaps this will work
the refresh.php shouldn't render the pic, but should return randomly a picname and creates the href and the img tag witht the inserted picurl.
but I think that wasn't your purpose in doing this refresh thing. so I'll try to modify it ok?:)
TheSauceMaster
06-12-2004, 04:35 PM
Thanks , very nice and easy to add ...aprreciate the effort.
EntityPacket
06-21-2004, 04:50 PM
This one didn't work for me. I get the follow errors from random.php.
Warning: array_rand(): Second argument has to be between 1 and the number of elements in the array in /home/clancor/public_html/vBulletin/test/refresh.php on line 25
Warning: Cannot modify header information - headers already sent by (output started at /home/clancor/public_html/vBulletin/test/refresh.php:25) in /home/clancor/public_html/vBulletin/test/refresh.php on line 32
Fiber
07-04-2004, 07:28 AM
Not working here either, must be I.E.
Thanks anyways nice mod.
Fiber
chrisvonc
07-27-2004, 04:45 PM
Will this pull from sub-directories inside the main picture directory you select or do they all just need to be dumped into the main folder?
socals
08-26-2004, 02:11 AM
I found out the hard way, by testing the refresh.php script by itself that it was reporting warning errors. I figured these errors were corrupting the header or something and found out my php.ini file had this setting:
error_reporting - E_ALL;
I changed it to:
error_reporting - E_FATAL;
And now the script works fine and I can see my images!
Don't know if anyone else has this problem, but check it out just in case. It made me alot happier!
I found the answer on:
http://forums.devarticles.com/archive/t-9337
Also, if you don't set $tnsize then it's really just sending the entire image and using the width statement to shrink it. (Fine if all your pics are thumbnails, or small anyway)
If you do set $tnsize, I found out that it wasn't getting the $ext correctly, it was when it read from folder, but not when it chose the random file name. You should get it then. Mine happen to read the .php last, so $ext was ".php" even though it found pics in the folder. So it fell through some logic.
I also changed the ImageCreate to ImageCreateTrueColor (I use only jpeg images) which produces a much better thumbnail, and ImageJPEG to spit out the image. I'm new to PHP/GD so this just happens to be the way I fixed it.
I then took the style page from the "paypal" project and copied it to make the window collapsable. All and all, it works!
Nautiqeman
04-05-2005, 10:03 PM
Is there a way to make it so the picture module refreshes, say every 5 seconds so that people can watch a picture show?
Can we also make this so people won't steal images, or bandwidth.
Check out the babe on the left...click on her ...
http://www.s3squad.com You may have to scroll down a little...look under the heading "Babes"
Should I release this as a module??
Nautiqeman
04-13-2005, 01:30 PM
Is there a way to make it so the picture module refreshes, say every 5 seconds so that people can watch a picture show?
Any ideas on this? Ideally I'd want the actually module to refresh every so many seconds... is this possible with PHP?
Dirty Harry
04-16-2005, 04:54 PM
Check out the babe on the left...click on her ...
http://www.s3squad.com You may have to scroll down a little...look under the heading "Babes"
Should I release this as a module??
YES you should release this as a module!
By the way, nice job on the website.
Dirty Harry
04-16-2005, 08:35 PM
Got it working, Looks great. Thanks!
geezzaa
07-11-2005, 08:56 PM
I cant get it to work :(
I followed the instructions but its not showing on the page
geezzaa
07-12-2005, 09:28 PM
i got the border with a red x http://ukcultivator.biz/index.php?page=test can somebody give me some guidance please
vBulletin® v3.7.2, Copyright ©2000-2008, Jelsoft Enterprises Ltd.