Hello All,
First of all, I've searched the entire forum but I am not able to get this working. Here is my situation, my zenphoto (latest) script resides in /album/ and I want to display random images on my /index.php (which resides outside the zen folder)
I've tried the script by others that I found throughout the forum but no luck. I either get an error or a blank page. Can someone provide me with a script that would perform what I have just stated?
Thanks for your time
Comments
Sorry ,I didn't get on what page exactly you want the latest images to show. The zp index page or that of your existing website?
I am trying to add RANDOM images to my index page outside the album folder, not the zp index.
in your /index.php file insert the following php lines:
`define('ZENFOLDER', 'album/zp-core');
require_once(ZENFOLDER . "/template-functions.php");`
For an example visit http://testalbum-2.sbillard.org/. The index.php file for this page is follows. (My zenphoto install is in a folder named zenphoto.)
`<?php <br />
define('ZENFOLDER', 'zenphoto/zp-core');
require_once(ZENFOLDER . "/template-functions.php");
function printHeadingImage($randomImage) {
$randomImageURL = 'zenphoto' . getURL($randomImage);
print "
$randomImage->getSizedImage(getOption('image_size')) .
"' alt="random image"n" . $randomImage->getTitle() .
'" />';
echo '';
}
header ('Content-Type: text/html; charset=' . getOption('charset'));
?>
Test Index
<?php <br />
$img = getRandomImages();
printHeadingImage($img);
?>
`
Here is my server info: Apache/2.0.59 (Win32) PHP/5.2.0RC3-dev
Parse error: parse error, unexpected T_STRING in C:\Program Files\Apache Group\Apache2\htdocs\site\random.php on line 6
`define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");`
this replaces the two lines in my post above.
As to your error message. What it is saying is that there is a syntax error in your file named random.php. You would have to post the contents of your random.php file for us to help you there.
All I am doing is copying and pasting your code to random.php, so i haven't added anything else. Here is my random.php and I am still getting T_STRING error
<?php
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'album');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
function printHeadingImage($randomImage) {
$randomImageURL = 'zenphoto' . getURL($randomImage);
print "<img src='".
$randomImage->getSizedImage(getOption('image_size')) .
"' alt="random image"n" . $randomImage->getTitle() .
'" />';
echo '</div>';
}
header ('Content-Type: text/html; charset=' . getOption('charset'));
?>
<html>
<head>
<title>Test Index</title>
</head>
<body>
<?php
$img = getRandomImages();
printHeadingImage($img);
?>
</body>
</html>
I placed the random image script on the index page of my website and it's working great! One thing though, it is loading extremely slow because it seem like it's loading the full image but as a thumbnail size. How can I allow the script to display the cached copy of the pictures instead of the original picture? So, the random image that is being displayed is the cached (smaller) image but still links to the original picture in zenphoto?
Again, here is the script I am using
`
<?php<br />
define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'album');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
header ('Content-Type: text/html; charset=' . getOption('charset'));
?>
Test Index
<?php<br />
$randomImage = getRandomImages();
$randomImageURL = getURL($randomImage);
echo "
$randomImage->getSizedImage(getOption('image_size')) .
"' alt="random image"n" . $randomImage->getTitle() .
'" />';
?>
`
`$randomImage->getSizedImage(getOption('image_size')) .`
To use `getDefaultSizedImage()` instead. Then it will use the same size image as your image pages. You can run the pre-cache image scripts to insure that all the images have cached this size.
There you will see all the functons that might be of use to you.
What HTML issues are you having? `getSizedImage` should produce a valid reference.