Does your website run Wordpress, as there is a nifty plugin for Wordpress that allows you to display photos called Zenshow. Otherwise, you may have to code a routine to grab the random images from the database and display them. I have a random function that works within Zenphoto. Let me see if it can modified to work in your scenario.
Patience please websat. We all have jobs, and are busy. I'm working with some ideas, but I have to work around my work schedule (8-5 M-F) and my personal responsibilities. We are all here on a voluntary basis. Others on the forum are under the same constraints I'm sure. So in other words, it may take time to get an answer to you, but if I don't someone else may have a quicker answer.
I can probably give you a push in the right direction. Take a look at Zenshow, a plugin designed to pull random images from the Zenphoto DB within Wordpress. There is a function in the code that deals with random photos. You may be able to rework that code to your needs, as it is just a SQL query to the zenphoto DB. That would be my suggestion on where to start. You can obtain Zenshow from a link somewhere on the wiki.
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']);
Comments
Does your website run Wordpress, as there is a nifty plugin for Wordpress that allows you to display photos called Zenshow. Otherwise, you may have to code a routine to grab the random images from the database and display them. I have a random function that works within Zenphoto. Let me see if it can modified to work in your scenario.
Thinkdreams.
Thanks for your answer, my website don't use wordpress, i made it myself using php (includes)
The code for the page where i want to have a random pic from zenphoto is here: http://test.websat-telecom.com/index.inc.php.txt
thanks for your help
The code for the index
http://www.websat-telecom.com/index.php.txt
The code for the page where i want to have a random pic from zenphoto is here: http://www.websat-telecom.com/index.inc.php.txt
That should get you started.
<?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
I've designed one but i had to remove a line in the connect() function to allow the widget to be used.
this one:
header('Content-Type: text/html; charset=ISO-8859-1');