The Arcive of Official vBulletin Modifications Site.It is not a VB3 engine, just a parsed copy! |
|
Random Images Anywhere Details »» | |||||||||||||||||||||||||
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:
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:
Show Your Support
|
Comments |
#62
|
||||
|
||||
Quote:
|
#63
|
|||
|
|||
Quote:
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 |
#64
|
|||
|
|||
Quote:
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. |
#65
|
|||
|
|||
Quote:
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> Code:
<td align=center><a href="$vboptions[forumhome].php$session[sessionurl_q]">$randimg</a></td> If anyone else can chime in on this with confirmation or corrections, that would be great. |
#66
|
|||
|
|||
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? |
#67
|
|||
|
|||
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=\"\" />"; 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=\"\" />"; 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! |
#68
|
||||
|
||||
Quote:
Thx again. Nice work and very useful. |
#69
|
|||
|
|||
Quote:
|
#70
|
|||
|
|||
Quote:
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"; 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 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. |
#71
|
|||
|
|||
Quote:
Code:
"<img src=\"".$randpic."\" border=\"0\" alt=\"\" />"; Code:
"<a href="http://www.website.com" target="_blank"><img src=\"".$randpic."\" border=\"0\" alt=\"\" />"; 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. |
|
|
X vBulletin 3.8.12 by vBS Debug Information | |
---|---|
|
|
More Information | |
Template Usage:
Phrase Groups Available:
|
Included Files:
Hooks Called:
|