Hi,
I have ZenPhoto and WordPress installed. They work a dream
However, I'm running into problems displaying a random thumbnail on my sidebar in WordPress?
I've looked at and tried Hacks and Extensions found in this forum and site, but am none the wiser. Up til 2am on a work-night was not good
Can someone please hold my hand and help me along this treacherous path?
Many thanks.
Please take a look here: http://www.zenphoto.org/2008/01/hacks/#zenphoto-as-plugin
Thanks for the reply.
I've looked there and seen these two parts
`define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php"); and $randomImage = getRandomImages();
$randomImageURL = getURL($randomImage);
echo "';`
Have already tried the above code before, but maybe I'm not using it right. Can you give me an example?
So I have my sidebar my WP theme, which is used for my ZP also.
How should I place the random thumbnail generator code into 'sidebar.php'?
Thankyou.
hi the way I integrated my latest, and most popular images in my wp-sidebar (see: http://www.bertsimons.nl/zenphoto/) in this way;
I make a php file called latest.php or in your case randomimage.php with content:
`
Zenphoto needs a bit more than your theme file to function, so just doing an include on it will not work. You need the
`define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");`
code in your sidebar to setup zenphotos environment.
Ov course zenphoto needs to be the folder where zenphoto was installed.
sbillard, those calls I already included.
Other zenphoto functions , like most popular, latest images and taglist get embedded in the wp-sidebar without a problem as you can see on my site. except for when using the printRandomImages(); I get the mysql error
I get the following error when I plug that into my site
`Warning: main(zenphoto/zp-core/template-functions.php) [function.main]: failed to open stream: No such file or directory in /home/michaelsiteuk/public_html/michaels/zenphoto/test.php on line 4
Fatal error: main() [function.require]: Failed opening required 'zenphoto/zp-core/template-functions.php' (include_path='.:/usr/share/pear') in /home/michaelsiteuk/public_html/michaels/zenphoto/test.php on line 4`
But there definitely is a 'template-functions.php' file in the zp-core folder
I placed that code, on its own, into a file :
www.mysite.com/myfolder/zenphoto/test.php
and my WP is at :
www.mysite.com/myfolder/wordpress/
And still it won't work.
Any ideas?
Thank you for your time.
sbillard, with your code the same..the first part to generate the latest images works, the randomimages functions returns the mysql error off which i've placed a screenshot here
http://www.bertsimons.nl/zenphoto/albums/various/publicity-photos/Screenshot.png
I am at a loss, there is some kind of conflict in your setup. http://testalbum-2.sbillard.org/ does not get any errors, but then Wordpress is not involved at all.
just did a fresh install of zenphoto 1.1.5 together with a new database and using the default theme.
so no wordpress involved and inserted the latest and random image code in the default theme.
but..same error output from the printRandomImages()....
as seen at http://www.bertsimons.nl/zenphototest/
i just try and it works fine.
But testing printRandomImages() i have seen thaht we can specify 'album' in $option.
function printRandomImages($number=5, $class=null, $option='all')
but after i see :
case "album":
$randomImage = getRandomImagesAlbum(); break;
Where we can specify the album name ?
Thanks.
You can't, it simply built to return random images of the whole gallery or the current album (and/or its subalbusm) you are within...
EDIT: Strange thing is that we have a line in the documentation of getRandomImgesAlbum that speaks of an option to get an album folder, but the option itself is not there. Maybe something got lost on the way or was forgotten...
acrylian, I use PHP version 4.3.10/MySQL version 3.23.58
GetRandomImagesAlbum() does provide for the option to specify the album from which the images are obtained. If empty it uses $_zp_current_album. However, printRandomImages() does not have such a parameter, so it only uses the current album. It will be relatively easy to extend printRandomImages() to add this parameter and pass it throught to getRandomImagesAlbum().