thanks for your help, i try this code for random.php:
<?php
require_once('classes.php');
$imageSize = (isset($_GET['s']) ? $_GET['s'] : 150);
$randomImage = getRandomImage();
$imageLinkURL = getImageLinkURL($randomImage);
print "<img src='".$randomImage->getSizedImage($imageSize)."' alt='".$randomImage->getTitle()."'/>";
function getRandomImage() {
global $_zp_current_image;
if(db_connect()) {
$random=query_single_row('SELECT images.filename, images.title, albums.folder FROM images INNER JOIN albums ON images.albumid = albums.id ORDER BY RAND() LIMIT 1');
$image = new Image(new Album(new Gallery(), $random['folder']), $random['filename']);
return $image;
} else {
return false;
}
}
function getImageLinkURL($image) {
if (zp_conf('mod_rewrite')) {
return WEBPATH . "/" . urlencode($image->getAlbumName()) . "/" . urlencode($image->name);
} else {
return WEBPATH . "/index.php?album=" . urlencode($image->getAlbumName()) . "&image=" . urlencode($image->name);
}
}
?>
and put that in the page where i want to see the random pic:
code
<?php include("http://galerie.websat-telecom.com/zen/random.php"); ?>
code
it don't work, in the page the link url is false:
http://www.websat-telecom.com/zen/zen/i.php?a=pi6alk-mast&i=Dsc05486.jpg&s=150
the good url must be: http://galerie.websat-telecom.com/zen/i.php?a=pi6alk-mast&i=Dsc05486.jpg&s=150