ZenphotoCMS Forum
How to show random picture? - Printable Version

+- ZenphotoCMS Forum (https://forum.zenphoto.org)
+-- Forum: Support (https://forum.zenphoto.org/forum-1.html)
+--- Forum: General support (https://forum.zenphoto.org/forum-4.html)
+--- Thread: How to show random picture? (/thread-6.html)

Pages: 1 2 3 4


How to show random picture? - Daxeno - 2006-06-09

Anyway ive fixed it, Check this code :




How to show random picture? - thinkdreams - 2006-06-09

You're most welcome Daxeno.




How to show random picture? - climberusa - 2006-06-09

Can either of you explain a bit more in detail what I need to do to fix the mysql error that daxeno was getting

"Error: Table 'akclimber.images' doesn't exist"
I'm getting the same error but don't quite understand how to remedy it.

Also, should my table prefixes be zen? Currently they are zp

Thanks for your help and for creating this function!




How to show random picture? - thinkdreams - 2006-06-09

climberusa-

first off, i can't take credit for the scripts. they were all obtained mostly from this thread.

daxeno rebuilt his db. by default the db uses a prefix of zen_ (i think). I usually set up a separate db, but some people don't have that luxury.

I believe you have to use the prefix function to place the prefix before every query in the sql statement. you could hardcode it to i suppose, but that might lead to problems if you ever share your scripts out to others.

anybody from the dev team want to comment? am i close, or way off?




How to show random picture? - Daxeno - 2006-06-10

climberusa, all you need to do is remove the prefix zp_. But doing this, you need to reset your database.
Go to config.php, and edit it, look for this $conf['mysqlprefix'] = "zp", then just delete the said prefix. it will then look like this $conf['mysql_prefix'] = "". Save it afterwards.
Now to reset you DB, delete your database from your phpmyadmin. place the setup.php back to the folder zen, then reinstall it.




How to show random picture? - climberusa - 2006-06-11

Thanks! I got it working. Would it be easy to have three random, but different photo's? I tried the obviou copy/paste but it just gives me the same three images each time. This is very cool.




How to show random picture? - Skwid - 2006-06-13

The prefix problem has been fixed in the Thinkdreams Theme release. It uses the prefix() function to query the right tables.




How to show random picture? - Guest - 2007-01-24

My wordpress and Zenphoto use the same database but different prefix, so I can easily make my plugin, and insert the following code into sidebar.php winthin folder of /wp-content/themes/default/.



there are 3 parameters you should pay attention to.
1.zen_
2.http://lidan.info/photo/
3._100_cw85_ch85.jpg

demo: http://lidan.info (see leftbar)

Good luck.




How to show random picture? - amucklow - 2007-02-12

up1m, thanks for your code. I'm also trying to get a random image from my zenphoto albums to appear in my sidebar, but my wordpress and zenphoto installs DON'T use the same db.

Is this possible? Most of the posts above offer instructions of how to align wordpress to the zenphoto code, changing dbs en route, but not vice versa i.e. switching dbs from within the wordpress file structure.

I've tried to require_once(--hostdetails--/zen/functions.php) but this causes a fatal error message.




How to show random picture? - amucklow - 2007-02-15

Hey - I gave up with going the hard way round, and installed my tables in the same db. Now it works great. Check out The Daily Pixel at http://www.strangerpixel.com. Thanks again up1m!




How to show random picture? - thinkdreams - 2007-02-15

As an aside, you can also use Zenshow to integrate random image functionality into wordpress, and is available on the wiki at:

http://www.zenphoto.org/trac/wiki/ZenphotoPlugins

It works fine on my wordpress install, which is 2.1 currently.




How to show random picture? - gwmbox - 2007-04-11

Hi all

Pardon my less learned abilities but trying to get a random image to come up in a static HTML page but keep getting mysql error messages - and really looking though the forum I am not really sure what code I should be using - any help appreciated.

Cheers




How to show random picture? - catyack - 2007-04-30

I see this thread is quite old, but I managed to get the random.php script working.

The problem is, I can not call the script from within another page using either javascript or img src , but if you click on the box empty box that shows up. It will display the image. I think it is almost working, can someone please tell me what I am doing wrong.

I have tried calling the random.php like this:
img src=""http://www.foolishcat.com/gallery/zen/random.php"">

and like this:

I would really like to use the img src - I think the problem is the last part of the script with the url encode. - here is the random.php script I am using:




How to show random picture? - zucye - 2007-07-13

This does not seem to work. Can anyone post an update on this mod??... Pleeeaaaseee!

I am using version 1.0.8.2, and it works wonderfully (www.zucye.net) and I would love to display a random picture (or pictures) of ONLY one category in my main blog page (I am NOT using word press, but sNews)




How to show random picture? - dspnorman - 2007-08-09

I've installed the ZenShow plugin off the Wiki, but it's not working... anyone else have trouble getting it to display properly? I keep getting errors which say the ZenShow functions are not defined, and when I edit the ZenShow config, it seems buggy and my changes don't stick...

Might be a problem with using Wordpress 2.2...




How to show random picture? - dspnorman - 2007-08-09

Well, it looks like others are able to use ZenShow with WP 2.2, so I'm not sure where I went wrong. thinkdreams, how do you call the plugin in your Wordpress pages? I've tried simply issuing a call to randomPhotos(); but I get a "function undefined" fatal error.

The plugin seemed to install okay, but it's as if it isn't making it's methods available to my WP installation. Is there any additional manual config needed?




How to show random picture? - thinkdreams - 2007-08-10

I'm calling the zenshow function with ``

You are correct in that it works on my Zenphoto and Wordpress installation just fine. Running SVN Zenphoto and WP 2.2.1. http://www.bushwoodworking.com

I'll be happy to help you work through it if you need help. Zenshow has always been fairly stable for me.




How to show random picture? - devilsoulblack - 2007-09-24

thanks thinkdreams for put how calling the zenshow function




How to show random picture? - thinkdreams - 2007-09-24

You're welcome. That function hasn't had a lot of documentation, so I've tried to keep it alive as long as I can.




How to show random picture? - sairuh - 2007-11-09

Using ZenShow's randomPhotos() function works great for displaying a random thumbnail on my WordPress (v2.3.1) blog... The problem, though, is that no image is showing, only the alt text. I suspect it has something to do with weirdness with the .htaccess file in either (both?) my WP or ZenPhoto (v1.1.2) installations.

Setup info: I'm doing this in a local dev environment (MAMP, Mac OS X 10.4.10), where the domain is localhost:8888 for both WP and ZenPhoto.

Apache 2.0.59


MySQL 5.0.37


PHP 5.2.1


One thing I notice under the WP options for ZenShow is that Table Prefix is always "zen_", which I cannot seem to change. In my case, my zenphoto tables are in their own db, and don't have a prefix --afaik, as my SQL knowledge is rather limited. Not sure if this would prevent the image from displaying.

Thanks in advance!