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.
Comments
I'm really racking my brain on this one.
ZenPhoto is fully installed and working a dream, but I've had no such luck with the Random Thumbnail.
Thank you.
P.S Lost my password for 'invision', then found it again :d
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 "
$randomImage->getSizedImage(getOption('image_size')) .
"' alt="random image"n" . $randomImage->getTitle() .
'" />';`
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.
I make a php file called latest.php or in your case randomimage.php with content:
`<?php $randomImage = getRandomImages();<br />
$randomImageURL = getURL($randomImage);
echo "
$randomImage->getSizedImage(getOption('image_size')) .
"' alt="random image"n" . $randomImage->getTitle() .
'" />';?>`
an place this in my zenphoto theme folder.
now in my wp-sidebar I put (because calling zenphoto functions straigt away doesn't work)
`
<?php include("http://www.bertsimons.nl/zenphoto/?p=randomimage"); ?>`
but what happens....
in my sidebar i get the error
`MySQL Query ( SELECT `zp_images`.filename,`zp_images`.title, `zp_albums`.folder, `zp_images`.show, `zp_albums`.show, `zp_albums`.password FROM `zp_images` INNER JOIN `zp_albums` ON `zp_images`.albumid = `zp_albums`.id WHERE `zp_albums`.folder!="" AND `zp_albums`.show=1 AND `zp_albums`.id != 199 AND `zp_albums`.id != 201 AND `zp_images`.show=1 ORDER BY RAND() LIMIT 1 ) Failed. Error: You have an error in your SQL syntax near 'show, `zp_albums`.show, `zp_albums`.password FROM `zp_images` INNER JOIN `zp_alb' at line 1`
so i guess there's something wrong with the getRandomImages() function..
`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.
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
`<?php <br />
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
header ('Content-Type: text/html; charset=' . getOption('charset'));
?>
Test Index
<?php <br />
$images = getImageStatistic(6, "latest");
foreach ($images as $image) {
echo "
$imageURL = getURL($image);
echo '
$image->getTitle() . '">
$image->getCustomImage(null, 44, 44, null, null, null, null, true) .
'" alt="' . $image->getTitle() . "\"/>n";
echo "
}
printRandomImages();
?>
`
Not integrated into WP, but maybe there is a conflict somewhere in that integration.
`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.
Root folder (..testalbum-2/htdocs): contains the above index.php file
zenphoto folders (..testalbum-2/htdocs/zenphoto) contains all the zenphoto files.
Your test.php should probably be in the `michaels` folder.
http://www.bertsimons.nl/zenphoto/albums/various/publicity-photos/Screenshot.png
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/
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.
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...
Does `getRandomImages()` work fopr you within Zenphoto? You can setup stopdesign to use it through the options.
I'm all for changing the name of that column - we really shouldn't use reserved words even if we do make sure to quote them, it's just not good practice.
For now, you can find some way to quote the column name, so it'd look something like `'zp_images'.'show'` (except - the single quotes should be backticks, but this forum won't show them since it uses that for code notation).
putting peck marks arount the words show in the line. (Both instances.)