As of 2020-03-07 (last updated/file date), the Custom Portal Island code for "Random Gallery Image" used on UBBCentral is:

Code
/* PHP CODE HERE */

$query = "
	SELECT POST_ID, FILE_DIR, FILE_NAME
	FROM {$config['TABLE_PREFIX']}FILES
	WHERE (FILE_DIR <> '' AND FILE_DIR IS NOT NULL)
	  AND (FILE_TYPE = 'jpg'
	   OR FILE_TYPE = 'gif'
	   OR FILE_TYPE = 'jpg'
	   OR FILE_TYPE = 'jpeg'
	   OR FILE_TYPE = 'png')
	ORDER BY rand()
	LIMIT 1
";
$sth = $dbh->do_query($query, __LINE__, __FILE__);
list($postId, $fDir, $fName) = $dbh->fetch_array($sth);
/* BODY HERE */
$body = <<<EOF

<div class="acvt">
<div style="height:{$config['MAX_THUMB_W_H']}px;overflow:hidden;position:relative;width:100%;display:inline-block;">
<a href="{$config['BASE_URL']}/ubbthreads.php?ubb=showgallery&Number=$postId"><img src="{$config['BASE_URL']}/gallery/$fDir/medium/$fName" alt="" title="" class="p2 cp oi" style="position:absolute;left:-100%;right:-100%;top:-100%;bottom:-100%;margin:auto;max-width:280px;min-height:100%;"></a>
</div>
</div>

EOF;

Attachments