Go Back   vb.org Archive > vBulletin Modifications > Archive > vB.org Archives > vBulletin 3.5 > vBulletin 3.5 Add-ons
FAQ Community Calendar Today's Posts Search

Reply
 
Thread Tools
Random Images Anywhere Details »»
Random Images Anywhere
Version: .1, by jugo jugo is offline
Developer Last Online: Oct 2009 Show Printable Version Email this Page

Version: 3.5.0 RC2 Rating:
Released: 08-15-2005 Last Update: 08-15-2005 Installs: 121
Uses Plugins
 
No support by the author.

1st of all I really love this plugin stuff.

Now for the Release. Please be gentle as this is my first release ever.

I want to thank Loneranger because I used his XML file as a template for mine. This was fun to make. I hope you guys enjoy it.

This will allow you to display random images anywhere you want.

Features:
  • Reads from a specified directory.
  • Only reads files whose filenames contain your specified text delimeter.
  • Can specify file extensions to display (GIF JPG PNG)
  • Perfect for babe of the week, etc.

See a working example here: http://www.freaks-network.com/forum/

The header images on the left will change whenever the page is refreshed.

Note: This generates a variable. Just insert the following wherever you want the random image to appear:

PHP Code:
$randpic 

Show Your Support

  • This modification may not be copied, reproduced or published elsewhere without author's permission.

Comments
  #62  
Old 11-18-2005, 06:42 AM
Allan's Avatar
Allan Allan is offline
 
Join Date: Jun 2003
Location: France
Posts: 1,513
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Allan
very nice

Click install

i'm a prob, look please:

My code actual:
Code:
<td class="alt1" width="100%">
with fonction (forumhome template):
Code:
<td class="alt1" width="100%"  style="background: url($randpic);">
but don't work
please help
Reply With Quote
  #63  
Old 11-18-2005, 12:11 PM
jugo jugo is offline
 
Join Date: Feb 2004
Location: Reading your emails.
Posts: 573
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Allan
please help
The reason why that does not work is because the $randpic variable is created with the "<img" Tags already in it.

If you're daring enough you can modify it to only generate the actual image url OR I can modify the release a bit more and make it generate TWO variables...

$randpic which will generate the full "<img" tags as normal and
$randpicurl which will only generate the image's url
Reply With Quote
  #64  
Old 11-18-2005, 12:12 PM
jugo jugo is offline
 
Join Date: Feb 2004
Location: Reading your emails.
Posts: 573
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by gyankow
Does the hack auto size or thumbnail an image? Also has anyone used this in CMPS?

This hack does not create thumbnails or autosize anything. It just displays the image in it's full glory.

It should work in CMPS as it is called in the global_start hook.
Reply With Quote
  #65  
Old 11-18-2005, 09:53 PM
dodgechargerfan dodgechargerfan is offline
 
Join Date: Aug 2005
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by Tru2Chevy
Thanks, however that still doesn't answer my question of where to put it. Everytime I look for something about changing the logo I just get directed to the AdminCP to change the image path.

Can you tell me the name of the template that needs to be modified to add this?

- Justin
If you're looking to have it replace your title banner on every refresh, you would go change the header template in the Common Templates section of Style Manager.

Experiment with this on a test style. (I have a separate style set up in vB that I turn on when I want to test stuff like this and then I turn it off once I am done. If things work, then I go and change the live styles for the users.)

Look for:
Code:
<td align=center><a href="$vboptions[forumhome].php$session[sessionurl_q]"><img src="$stylevar[titleimage]" border="0" alt="$vboptions[bbtitle]" /></a></td>
CHANGE to:
Code:
<td align=center><a href="$vboptions[forumhome].php$session[sessionurl_q]">$randimg</a></td>
I'm relatively new to vB stuff, so take this suggestion with a bit of caution. At the very worst you can just change it back and be no worse off.

If anyone else can chime in on this with confirmation or corrections, that would be great.
Reply With Quote
  #66  
Old 11-18-2005, 09:55 PM
dodgechargerfan dodgechargerfan is offline
 
Join Date: Aug 2005
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I am looking at this product for a type of picture banner.

The challenge that I have is that I want the banner to be made up of many different pictures.

Is it possible to replicate the part of the xml file to generate several variables?
Perhaps $randpic1 $randpic2 $randpic3 etc.... for as many as I wanted to have lined up in the banner?
Reply With Quote
  #67  
Old 11-19-2005, 01:41 PM
dodgechargerfan dodgechargerfan is offline
 
Join Date: Aug 2005
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

I decided to take a run at making the changes myself and it worked out okay after a bit of trial and error.

I checked with jugo before posting this.

All I did was add code into the xml file to generate more variables.

From this:
Code:
$rand = mt_rand(0, $i);

$randpic = $imgurl.$files[$rand];
$randpic = "<img src=\"".$randpic."\" border=\"0\" alt=\"\" />";
To this:
Code:
$rand1 = mt_rand(0, $i);
$rand2 = mt_rand(0, $i);
$rand3 = mt_rand(0, $i);
$rand4 = mt_rand(0, $i);
$rand5 = mt_rand(0, $i);
$rand6 = mt_rand(0, $i);

$randpic1 = $imgurl.$files[$rand1];
$randpic1 = "<img src=\"".$randpic1."\" border=\"0\" alt=\"\" />";
$randpic2 = $imgurl.$files[$rand2];
$randpic2 = "<img src=\"".$randpic2."\" border=\"0\" alt=\"\" />";
$randpic3 = $imgurl.$files[$rand3];
$randpic3 = "<img src=\"".$randpic3."\" border=\"0\" alt=\"\" />";
$randpic4 = $imgurl.$files[$rand4];
$randpic4 = "<img src=\"".$randpic4."\" border=\"0\" alt=\"\" />";
$randpic5 = $imgurl.$files[$rand5];
$randpic5 = "<img src=\"".$randpic5."\" border=\"0\" alt=\"\" />";
$randpic6 = $imgurl.$files[$rand6];
$randpic6 = "<img src=\"".$randpic6."\" border=\"0\" alt=\"\" />";
Now I just use $randpic1 ..2 ..3 etc... where I want the images to show up.

In my case I wanted to use it to display a different row of pictures everytime a page loaded. You can see how it came out at www.moparnuts.com
I want to tweak things a bit to make it dsiplay a little cleaner. Maybe add a resize function or fix up the justification to get things centered and fill up the white space.

I would like to suggest another idea as well. I'm not sure if I'll be able to figure this one out.

Is there a way to have the name of the file show up as a tooltip when a user hovers their mouse over the picture. It would be great if you could parse out the prefix and file extension too.

With this new idea, I'd like to have the filenames represent the user that owns the car. That way, when someone hovers over the picture, they get a tooltip that tells who owns the car...

Thanks again, jugo, for a great tweak!
Reply With Quote
  #68  
Old 11-19-2005, 01:49 PM
Harry72's Avatar
Harry72 Harry72 is offline
 
Join Date: May 2004
Location: Germany, Bavaria
Posts: 105
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by dodgechargerfan
I decided to take a run at making the changes myself and it worked out okay after a bit of trial and error.

I checked with jugo before posting this.

All I did was add code into the xml file to generate more variables.

From this:
Code:
$rand = mt_rand(0, $i);

$randpic = $imgurl.$files[$rand];
$randpic = "<img src=\"".$randpic."\" border=\"0\" alt=\"\" />";
To this:
Code:
$rand1 = mt_rand(0, $i);
$rand2 = mt_rand(0, $i);
$rand3 = mt_rand(0, $i);
$rand4 = mt_rand(0, $i);
$rand5 = mt_rand(0, $i);
$rand6 = mt_rand(0, $i);

$randpic1 = $imgurl.$files[$rand1];
$randpic1 = "<img src=\"".$randpic1."\" border=\"0\" alt=\"\" />";
$randpic2 = $imgurl.$files[$rand2];
$randpic2 = "<img src=\"".$randpic2."\" border=\"0\" alt=\"\" />";
$randpic3 = $imgurl.$files[$rand3];
$randpic3 = "<img src=\"".$randpic3."\" border=\"0\" alt=\"\" />";
$randpic4 = $imgurl.$files[$rand4];
$randpic4 = "<img src=\"".$randpic4."\" border=\"0\" alt=\"\" />";
$randpic5 = $imgurl.$files[$rand5];
$randpic5 = "<img src=\"".$randpic5."\" border=\"0\" alt=\"\" />";
$randpic6 = $imgurl.$files[$rand6];
$randpic6 = "<img src=\"".$randpic6."\" border=\"0\" alt=\"\" />";
Now I just use $randpic1 ..2 ..3 etc... where I want the images to show up.

In my case I wanted to use it to display a different row of pictures everytime a page loaded. You can see how it came out at www.moparnuts.com
I want to tweak things a bit to make it dsiplay a little cleaner. Maybe add a resize function or fix up the justification to get things centered and fill up the white space.

I would like to suggest another idea as well. I'm not sure if I'll be able to figure this one out.

Is there a way to have the name of the file show up as a tooltip when a user hovers their mouse over the picture. It would be great if you could parse out the prefix and file extension too.

With this new idea, I'd like to have the filenames represent the user that owns the car. That way, when someone hovers over the picture, they get a tooltip that tells who owns the car...

Thanks again, jugo, for a great tweak!

Thx again. Nice work and very useful.
Reply With Quote
  #69  
Old 11-20-2005, 12:56 AM
rharbison rharbison is offline
 
Join Date: Apr 2002
Posts: 58
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by jugo
...OR I can modify the release a bit more and make it generate TWO variables...

$randpic which will generate the full "<img" tags as normal and
$randpicurl which will only generate the image's url
Not sure if you noticed my earlier post. Is there any way to add a variable that would create a clickable link with the image? That would work very well to feature random thread thumbnails.
Reply With Quote
  #70  
Old 11-22-2005, 12:39 PM
dodgechargerfan dodgechargerfan is offline
 
Join Date: Aug 2005
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Is there a way to have the name of the file show up as a tooltip when a user hovers their mouse over the picture. It would be great if you could parse out the prefix and file extension too.

With this new idea, I'd like to have the filenames represent the user that owns the car. That way, when someone hovers over the picture, they get a tooltip that tells who owns the car...
Some hacking and slashin and I was able to get this aspect working.

I'm not sure how valuable it is to everyone else, but it at least serves as an example of some changes that can be added.

I'll leave it to jugo to decide if it should be added to the product.

For the record, I got the parsing code from an example in the PHP online manual and adjusted things to suit my needs.

I added a function and a couple of working variables at the top of the PHP code in the xml file:
Code:
function remover($string, $sep1, $sep2)
{
       $string = substr($string, 0, strpos($string,$sep2));
       $string = substr(strstr($string, $sep1), strlen($sep1));

       return $string;
}

$str1 = $vbulletin->options['randimg_delim'];
$str2 = ".jpg";
This function strips out text from a string based on characters that surround the text that you want.
Sending "some text (a note) some more text" with "(" and ")" as $sep1 and $sep2 would return "a note".
I added in the strlen call so that it would strip out whatever is used for the delimiter.

And then I use another variable and assign the results of the function to it.
Then the variable gets used in the building of the value for randpic# which is the variable that you can then use anywhere you want the picture to show up.
Code:
$randpic1 = $imgurl.$files[$rand1];
$alt1 = remover($randpic1, $str1, $str2);
$randpic1 = "<img src=\"".$randpic1."\" border=\"0\" alt=\"".$alt1."\" />";
The end result: when you hover your mouse over the picture, the tooltip that comes up is the image filename without the banner delimiter prefix and the file extension.

The only trick to this is to make sure that whatever you use for the banner prefix delimiter, it should be unique in the entire url of the file. Otherwise the remover function will stop on the first instance of the delimiter and you'll get whatever is left of the url as a tooltip.

So, using "banner" as your delimiter wouldn't work if you put all of your files in a directory called banner.....

"/images/banner/bannerimage1.jpg" would give you "/bannerimage1" as the alt text... not really a problem, but that's not what I was after. I wanted to see "image1" come up.

You could easily solve this by adding another character in the file name after banner and making that your delimiter.

"/images/banner/bannertimage1.jpg" and a delimiter of "bannert" would work just fine.

Thanks again to jugo for the great work.

I would not have been able to get this banner thing working without the headstart that his product provided.
Reply With Quote
  #71  
Old 11-22-2005, 01:05 PM
dodgechargerfan dodgechargerfan is offline
 
Join Date: Aug 2005
Posts: 94
Благодарил(а): 0 раз(а)
Поблагодарили: 0 раз(а) в 0 сообщениях
Default

Quote:
Originally Posted by rharbison
Not sure if you noticed my earlier post. Is there any way to add a variable that would create a clickable link with the image? That would work very well to feature random thread thumbnails.
Making a clickable image is as easy as changing the code in the xml file from this:

Code:
"<img src=\"".$randpic."\" border=\"0\" alt=\"\" />";
to something like this:

Code:
"<a href="http://www.website.com" target="_blank"><img src=\"".$randpic."\" border=\"0\" alt=\"\" />";
The challenge is figuring out what to link to.

If it's the original image file, that might not be too hard as I think the information necessary is already part of the product.

If it's something else, then I think you're pretty much looking at hard coding it right into the code example above or generating the links in some other way.

I might take run at this and link my banner pics to the user's profile.

I'll post my results here with jugo's permission of course.

I may not get to this until next week, though.
Reply With Quote
Reply


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 05:43 AM.


Powered by vBulletin® Version 3.8.12 by vBS
Copyright ©2000 - 2024, vBulletin Solutions Inc.
X vBulletin 3.8.12 by vBS Debug Information
  • Page Generation 0.06017 seconds
  • Memory Usage 2,336KB
  • Queries Executed 25 (?)
More Information
Template Usage:
  • (1)SHOWTHREAD
  • (1)ad_footer_end
  • (1)ad_footer_start
  • (1)ad_header_end
  • (1)ad_header_logo
  • (1)ad_navbar_below
  • (1)ad_showthread_beforeqr
  • (12)bbcode_code
  • (1)bbcode_php
  • (8)bbcode_quote
  • (1)footer
  • (1)forumjump
  • (1)forumrules
  • (1)gobutton
  • (1)header
  • (1)headinclude
  • (1)modsystem_post
  • (1)navbar
  • (6)navbar_link
  • (120)option
  • (1)pagenav
  • (1)pagenav_curpage
  • (4)pagenav_pagelink
  • (11)post_thanks_box
  • (11)post_thanks_button
  • (1)post_thanks_javascript
  • (1)post_thanks_navbar_search
  • (11)post_thanks_postbit_info
  • (10)postbit
  • (11)postbit_onlinestatus
  • (11)postbit_wrapper
  • (1)spacer_close
  • (1)spacer_open
  • (1)tagbit_wrapper 

Phrase Groups Available:
  • global
  • inlinemod
  • postbit
  • posting
  • reputationlevel
  • showthread
Included Files:
  • ./showthread.php
  • ./global.php
  • ./includes/init.php
  • ./includes/class_core.php
  • ./includes/config.php
  • ./includes/functions.php
  • ./includes/class_hook.php
  • ./includes/modsystem_functions.php
  • ./includes/functions_bigthree.php
  • ./includes/class_postbit.php
  • ./includes/class_bbcode.php
  • ./includes/functions_reputation.php
  • ./includes/functions_post_thanks.php 

Hooks Called:
  • init_startup
  • init_startup_session_setup_start
  • init_startup_session_setup_complete
  • cache_permissions
  • fetch_threadinfo_query
  • fetch_threadinfo
  • fetch_foruminfo
  • style_fetch
  • cache_templates
  • global_start
  • parse_templates
  • global_setup_complete
  • showthread_start
  • showthread_getinfo
  • forumjump
  • showthread_post_start
  • showthread_query_postids
  • showthread_query
  • bbcode_fetch_tags
  • bbcode_create
  • showthread_postbit_create
  • postbit_factory
  • postbit_display_start
  • post_thanks_function_post_thanks_off_start
  • post_thanks_function_post_thanks_off_end
  • post_thanks_function_fetch_thanks_start
  • post_thanks_function_fetch_thanks_end
  • post_thanks_function_thanked_already_start
  • post_thanks_function_thanked_already_end
  • fetch_musername
  • postbit_imicons
  • bbcode_parse_start
  • bbcode_parse_complete_precache
  • bbcode_parse_complete
  • postbit_display_complete
  • post_thanks_function_can_thank_this_post_start
  • pagenav_page
  • pagenav_complete
  • tag_fetchbit_complete
  • forumrules
  • navbits
  • navbits_complete
  • showthread_complete