RMRK is retiring.
Registration is disabled. The site will remain online, but eventually become a read-only archive. More information.

RMRK.net has nothing to do with Blockchains, Cryptocurrency or NFTs. We have been around since the early 2000s, but there is a new group using the RMRK name that deals with those things. We have nothing to do with them.
NFTs are a scam, and if somebody is trying to persuade you to buy or invest in crypto/blockchain/NFT content, please turn them down and save your money. See this video for more information.
LOL images

0 Members and 1 Guest are viewing this topic.

*
( ´ิ(ꈊ) ´ิ) ((≡^⚲͜^≡)) (ી(΄◞ิ౪◟ิ‵)ʃ)
Rep:
Level 102
(っ˘ڡ˘ς) ʕ•̼͛͡•ʕ-̺͛͡•ʔ•̮͛͡•ʔ (*ꆤ.̫ꆤ*)
2014 Avast Ye Merry Pirate!2013 Avast Ye Merry Pirate Award2012 Avast Ye Merry Pirate AwardFor frequently finding and reporting spam and spam bots2011 Most Unsung Member2011 Avast Ye Merry Pirate2010 Avast Ye Merry Pirate Award
So I have a random image archive thing, here.

You just click the image and it loads another, by refreshing the page. Here's how I have everything working currently:

My index.html is this:

Code: [Select]
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Random Image Archive</title>
</head>
<body style="margin:50px; text-align:center; background-color:#eeeeee;">
<center><h2>Random Image Archive : Click image to show another
</script></h2><br>
<strong>WARNING:</strong> Some of these images are gross, contain nudity or may otherwise be offensive!<br><br>
 <a href="JavaScript:location.reload(true);"><img src="http://i.slyph.org/r/i.php" alt="Click to show another" border="2" /></a>


</body>
</html>

And the php that's embedded image-style is this:

<?php
// Image folder.
$folder = &#39;&#39;;

// Extensions.
$exts = &#39;jpg jpeg png gif&#39;;

$files = array(); $i = -1// Initialize some variables
if (&#39;&#39; == $folder) $folder = &#39;./&#39;;

$handle opendir($folder);
$exts explode(&#39; &#39;, $exts);
while (false !== ($file readdir($handle))) {
    foreach(
$exts as $ext) { // for each extension check the extension
        
if (preg_match(&#39;/\.&#39;.$ext.&#39;$/i&#39;, $file, $test)) { // faster than ereg, case insensitive
            
$files[] = $file// it&#39;s good
            
++$i;
            }
        }
    }
closedir($handle); // We&#39;re not using it anymore
mt_srand((double)microtime()*1000000); // seed for PHP < 4.2
$rand mt_rand(0$i); // $i was incremented as we went along

header(&#39;Location: &#39;.$folder.$files[$rand]); // End
?>


Though I'd like it so, say, you could right click on the displayed image and get the URL of the image instead of the script. If you "visit" the image (example: right-clicking in firefox and selecting View Image), the script processess again and you end up with a real url, though a different image.

My php knowledge is basically non-existant. If not making it work like I described in the above paragraph is possible, maybe I could use the same script to also display a text link underneath or something to the image. Though that would result in multiple calls to the script, which would end up with the image shown not matching with the URL :(

Sorry if I'm not making any sense ;_;
bringing sexy back

*
Rep:
Level 93
<o>_<o>
2014 Funniest MemberParticipant - GIAW 11Bronze - GIAW 92011 Best RPG Maker User (Creativity)
You and your porn.