The following warnings occurred:
Warning [2] Undefined array key "threadviews_countguests" - Line: 745 - File: showthread.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php 745 errorHandler->error_callback
Warning [2] Undefined array key "allowautourl" - Line: 584 - File: inc/class_parser.php PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/inc/class_parser.php 584 errorHandler->error_callback
/inc/class_parser.php 228 postParser->parse_mycode
/inc/functions_post.php 830 postParser->parse_message
/showthread.php 916 build_postbit
Warning [2] Undefined property: MyLanguage::$thread_modes - Line: 46 - File: showthread.php(1650) : eval()'d code PHP 8.1.31 (Linux)
File Line Function
/inc/class_error.php 153 errorHandler->error
/showthread.php(1650) : eval()'d code 46 errorHandler->error_callback
/showthread.php 1650 eval




Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to: random images
#2
Use: DynPages

with this snippet:

<?php
global $args;
$dir = 'data/uploads/'.$args[0];
$files1 = scandir($dir);
$max = count($files1)-1;
$a=get_site_url(false);
$p=explode("/",$a);
$dir="/".$p[3]."/".$dir;
$a=rand(2,$max);
echo "<img src='".$dir."".$files1[$a]."' width='100%'>"
?>

Call it with: {% rndpic slider/3/ %} assumes of course that you name the component "rndpic" and your pic-folder "slider/3/"

You can put your images in a folder. That's all.

If you need a shadowbox you can add this very easy.

The snippets read any picture in a given folder, put them in an array and select a random pic for display.
Reply


Messages In This Thread
How to: random images - by datiswous - 2014-12-11, 21:26:57
RE: How to: random images - by Lars - 2014-12-12, 19:24:30
RE: How to: random images - by datiswous - 2014-12-12, 22:57:18
RE: How to: random images - by lesh - 2014-12-13, 01:57:44
RE: How to: random images - by datiswous - 2014-12-12, 19:52:57
RE: How to: random images - by Lars - 2014-12-12, 20:29:17
RE: How to: random images - by shawn_a - 2014-12-13, 02:01:07
RE: How to: random images - by datiswous - 2014-12-15, 04:37:44
RE: How to: random images - by Lars - 2014-12-13, 02:44:46
RE: How to: random images - by shawn_a - 2014-12-15, 04:42:28
RE: How to: random images - by datiswous - 2014-12-15, 06:33:23



Users browsing this thread: 1 Guest(s)