Member
Member
MeenXo   2007-12-06, 18:18
#1

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

Administrator
Administrator
acrylian   2007-12-06, 18:46
#2

A random images function is already included in zenphoto 1.1.2 That's why you get a blank page if you call it again within your theme: http://www.zenphoto.org/trac/wiki/TemplateFunctionsGuide

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?

Member
Member
MeenXo   2007-12-06, 20:54
#3

Thanks for the reply

I am trying to add RANDOM images to my index page outside the album folder, not the zp index.

Member
Member
sbillard   2007-12-06, 21:56
#4

The following seems to work. (I have not done extensive testing.)

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.)

`

Member
Member
MeenXo   2007-12-07, 07:25
#5

I am receiving the following error now, I am not an PHP expert, so I have no clue what would be the problem.
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

Member
Member
sbillard   2007-12-07, 18:06
#6

First, after some experimenting, the proper lines to add to your index.php file are:

`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.

Member
Member
MeenXo   2007-12-13, 05:48
#7

Hello sbillard.

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

Member
Member
sbillard   2007-12-13, 18:10
#8

You have imbalanced quotation marks in your print statement.

Member
Member
MeenXo   2007-12-26, 10:02
#9

I am back

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

`

Test Index

Member
Member
sbillard   2007-12-26, 16:52
#10

The script will display a chached image if one already exists. Otherwise it will resize the full image and place it in the cache. You could change the script to display the default sized image by changing the line:

$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.

Member
Member
randee   2008-01-01, 16:32
#11

this is just getting a random image right? not getting a random image for album thumbs, right?

Member
Member
sbillard   2008-01-02, 02:03
#12

Yes, it just puts out an image. You can change the code that puts out the href to put out a thumb instead if that is what you want, or you can just change the parameter to getSizedImage to the thumb size. Also change the reference to the album instead of the image.

Member
Member
peterhebert   2008-01-10, 20:46
#13

I have used this code, but I would like to know how you would get the height and with into the image tag (so that it validates as XHTML)? I have tried the getDefaultWidth() and getDefaultHeight() functions, but they do not seem to work in this context. sbillard, could you please show how one would do this? Also I want to show a link to the album.

Member
Member
sbillard   2008-01-10, 23:19
#14

Take a look at the function references on the zenphoto.org WEB pages: http://www.zenphoto.org/documentation/

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.

  
Powered By MyBB, © 2002-2026 MyBB Group.
Made with by Curves UI.