Member
Member
skyscape   2009-03-10, 22:38
#1
I need to be able to grab 5 latest gallery pics from Zenphoto and display them on home page of the site as thumbs. Anybody know how I can do that?

Please help

Thanks
Ben
Administrator
Administrator
acrylian   2009-03-11, 10:01
#2
http://www.zenphoto.org/2008/01/hacks/#zenphoto-as-plugin and please do a forum search about that, there are quite some threads about this.
Member
Member
skyscape   2009-03-11, 17:17
#3
I appreciate your help acrylian.
I actually did do search and looked through every thread to page 20, and I did manage to find threads similar to mine, but with no replies.

I would like you to know that I'm a newbie in the PHP department. And I need some more help with the script.

So I put the first code above the header line

define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");

And I put this code in the body where I want image to appear. The script worked but then I noticed that this script only shows one random image in full size.

$randomImage = getRandomImages();
$randomImageURL = getURL($randomImage);
echo "
<img src='". $randomImage->getSizedImage(getOption('image_size')) . "'
alt=\"random image\"\n" . $randomImage->getTitle() . '" />';

I want the script to show 5 latest thumbs in horizontal position on the page. Right now the script shows one random image in full size. So I don't know to what extent I can modify it, and if I can modify it, what should I be doing?

Thanks
Ben
Administrator
Administrator
acrylian   2009-03-11, 18:23
#4
Ok, since "printlatestimages" is a plugin function you need also to include the plugin after the template-functions:
`require_once(WEBPATH . "/" . ZENFOLDER . "/plugins/image_album_statistics.php");`

The available functions of that plugin are documentated here: http://www.zenphoto.org/documentation/plugins/_plugins---image_album_statistics.php.html
Member
Member
skyscape   2009-03-11, 21:39
#5
Ok, I included the statistics plugin. And the code that I need to use from the statistics file is [line 509]

void printLatestImages( [string $number = 5], [string $albumfolder = ''], [bool $showtitle = false], [bool $showdate = false], [bool $showdesc = false], [integer $desclength = 40], [string $showstatistic = ''], [integer $width = 85], [integer $height = 85], [bool $crop = true], [bool $collection = false] )

Now the challenge is, how do I write the php code to call out this function from the statistics file and spit it in the main page where I want thumbs to appear?

For the template function, there is that code, which I have pasted in the above reply but I dont see the code for statistics file.

Thanks
Ben
Administrator
Administrator
acrylian   2009-03-12, 10:35
#6
Please really take a look at our functions guide: http://www.zenphoto.org/2008/04/how-to-read-the-zenphoto-functions-guide/
Member
Member
skyscape   2009-03-12, 20:02
#7
Hello Acrylian
I think you assume I can code PHP. I cannot. I can edit a few little php elements here and there, but I'm not a php coder. I read the fuction guide, and I have very little clue what I'm supposed to do.

Let me know if you can help me resolve this, I know you are busy.
I appreciate your help thusfar.

Thanks
Ben
Member
Member
mr code   2009-03-13, 18:39
#8
thanks for this. not quite what I'm doing, but you solved my problem! Smile
Member
Member
skyscape   2009-03-13, 19:03
#9
Hello Mr. Code, would you mind sharing, and maybe help me out with my issue?
Member
Member
skyscape   2009-03-16, 17:30
#10
For everyone who needs this, and I know many folks will find this important,
Here is the code to call out 3 recent images.

1. Place this code above the header

<?php define('ZENFOLDER', 'zp-core');
define('WEBPATH', 'zenphoto');
require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php");
require_once(WEBPATH . "/" . ZENFOLDER . "/plugins/image_album_statistics.php");
?>

2. Place this code in the body where you want images to appear

<?php
printLatestImages(3, '', false, false, false, 40, '', 200, 100, true, true);
?>
Member
Member
nothingbutsong   2009-03-21, 06:16
#11
I'm getting a fatal error. It doesn't recognize the printlatestimages hook.

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