I guess it should be done by javascript, anyone know code?
How to display random gallery in html page? anyone know code?
Collapse
X
-
do you know how to code php? What scripts are you using?Need some web dev? Contact ME
ICQ - 366621126 -
if you have all your images in a database just do a query that is random, mysql has a default by rand functionNeed some web dev? Contact ME
ICQ - 366621126Comment
-
this code
this is php, im use in nenasnenas.com.ar and this code to "add to blog".
Code add to blog/mySpace
And this code aleatoria.phpCode:<!-- inicio imagen aleatoria NenasNenas.com.ar --> <a href="yourwebsite" style="display:block; width:135px;height:87px;margin:5px auto auto;border-top:1px solid #fff;border-left:1px solid #fff; border-bottom:1px solid #000;border-right:1px solid #000;text-align:center;vertical-align:middle;text-decoration:none;line-height:20px;color:#000;"> <img src="yourwebsite/aleatoria.php" alt="Nenas, nenas y mas nenas!" style="margin:2px auto 3px;border:none; height:80px;" center></a> <a href="yourwebsite" style="display:block; width:135px;height:20px;margin:0px auto 5px;border-top:1px solid #fff;border-left:1px solid #fff; border-bottom:1px solid #000;border-right:1px solid #000;text-align:center;vertical-align:middle;text-decoration:none;line-height:20px;font-family:Symbol, serif; color:#0a00c4;">Más nenas!</a> <!-- Fin imagen aleatoria NenasNenas.com.ar -->
sorry my english, came from jujuy, argentinaPHP Code:<?php //donde estan guardadas las fotos $dir_imagenes ='albums/miniaturas/'; $elementos1 =array(); $n1 = 0; $r1 = 0; $directorio1 = opendir ($dir_imagenes); while ($elemento = readdir ($directorio1)){ if (($elemento != '.') && ($elemento != '..')){ $elementos1[$n1] = $elemento; $n1++; } } $r1 = rand(0,$n1-1); <img src="albums/imagenes/grupo/'. $elementos2[$r2] . '" alt ="otra foto" WIDTH=150 HEIGTH=150 /></a>'; closedir ($directorio1); $url=$dir_imagenes.$elementos1[$r1]; /*$fichero=fopen($url,"r"); while(!feof($fichero)) $texto.=fread($fichero,1024); fclose($fichero);*/ // la abrimos para recuperar su contenido $fichero=fopen($url,"r"); while(!feof($fichero)) $texto.=fread($fichero,1024); fclose($fichero); // y finalmente mostramos el contenido de la imágen recuperada echo $texto; ?>
Comment
-
I write a javascript for you,enjoy it
Code:<script language="javascript"> var list = new Array(); //define the gallery content array //replace the "your_url" and "your_img" with your own list[0]="<a href=\"your_url\"><img src=\"your_img1\"></a>"; list[1]="<a href=\"your_url\"><img src=\"your_img2\"></a>"; list[2]="<a href=\"your_url\"><img src=\"your_img3\"></a>"; list[3]="<a href=\"your_url\"><img src=\"your_img4\"></a>"; list[4]="<a href=\"your_url\"><img src=\"your_img5\"></a>"; list[5]="<a href=\"your_url\"><img src=\"your_img5\"></a>"; list[6]="<a href=\"your_url\"><img src=\"your_img5\"></a>"; list[7]="<a href=\"your_url\"><img src=\"your_img5\"></a>"; list[8]="<a href=\"your_url\"><img src=\"your_img5\"></a>"; list[9]="<a href=\"your_url\"><img src=\"your_img5\"></a>"; list[10]="<a href=\"your_url\"><img src=\"your_img5\"></a>"; list[11]="<a href=\"your_url\"><img src=\"your_img5\"></a>"; list[12]="<a href=\"your_url\"><img src=\"your_img5\"></a>"; list[13]="<a href=\"your_url\"><img src=\"your_img5\"></a>"; var list_count = list.length; function show_list(n) { show = n; var temp; var ran = rand(); for (i=0;i<show;i++){ temp=""; temp=list[ran]; document.write(temp); ran++; } } function rand() { var num=Math.random( ); var num=Math.floor(num * (list_count-show+1)); return num; } show_list(3); </script>Comment

Comment