I've read a lot of the forums to get me up and going and I've manage to tweak my gallery to how I want it. (Thanks all!) I want to do one last thing and get a random image from one of my albums on my front page (it is in html) of my website that changes every time someone visits it. Is this possible?
Thanks in advance and thanks to all the help I've gotten thus far by just reading the forums.
-Y
Posts: 24
I would love to know how to do that as well. I want a random image to be displayed in the intro page of my web site
Posts: 97
I have that situation up and running since long
i use SSI in my regular HTML flat files to add the random image by inserting following code in the HTML pages:
<?php @readfile('http: // www. my domain . com/path_to_gallery/index.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=title'); ?>
to have PHP SSI parsed you need to add in your .htaccess something like ( the exact version depends on what PHP and apache you use - hence you may have to Google for
php ssi in html files
a bit and try )
the lines to include in .htaccess are something like
AddType application/x-httpd-php .html .htm
AddHandler application/x-httpd-php .html .htm
usually you also may first to remove the existing handler that parses html or shtml files for perl SSI. this would be done by
removeHandler server-parsed htm html xhtml shtml
Good luck
hans
Kriya Yoga | Secrets of Love | Photo gallery of the Philippine island
Posts: 6136
I have a flash minislideshow that may be what you are looking for.
get it on my site
-s
FlashYourWeb and Your Gallery
Posts: 15
Hi! I've tried this without any luck
If I go to http://cholito.org/galeria/main.php?g2_view=imageblock.External&g2_blocks=randomImage&g2_show=none I can see the random image. But using this code doesn't work.
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" lang="en" xml:lang="en"> <head> <title>TEST</title> </head> <body><?php @readfile('http://cholito.org/galeria/main.php?g2_view=imageblock.External&g2_blocks=randomImage'); ?></body> </html>Also, the content of my .htaccess is this:
See it for yourself: http://cholito.org/test/
BTW if I use the file as index.html it shows a 404 page, if I use index.php it shows the file
Any advice will be appreciated!
Posts: 97
the.htaccess directives given above are for APACHE2.2
HOWEVER
it you are using Apache/1.3.37
you may have to study the directives for your version to see if they are same for old apache as well.
at first glance it appears all correct
i use successfully above random image code for many pages - all either html4.01 OR xhtml1.1
another point you may want to fix first is your HTML code validation - see
http://validator.w3.org/check?verbose=1&uri=http%3A%2F%2Fcholito.org%2Ftest%2F
there appears a parsing error of some kind of your pages which might be occurring if your HTML tags or totally messed up earlier in your page.
to dissolve your HTML-errors - always start TOP error of the page first and go step by step from TOP to bottom of errors UNTIL page validated !!!
if i use in my browser your above random image URL - i get always a correct random image displayed in my browser - meaning that the random code-URL works in general but NOT in your page - most likely due to errors in code OR apache misconfiguration.
I have no more experience with apache 1.3 and could be of no further assistance.
in my first signature link below ( domain index-page ) i use this code succcessfully - its a HTML4.01 page on apache 2.2.
good luck
hans
Kriya Yoga | Secrets of Love | Photo gallery of the Philippine island
Posts: 15
Well, yeah, the server has the 1.3.37 version. I just asked if they are going to upgrade soon ;)
Thank for your help thou
Posts: 97
there DEFINITELY is a solution NOW with apache 1.3
you just need to figure out which by studying apache1.3 onliine docs
however first i would validate your HTML code before doing anything else
years ago i had another host and used apache 1.3 - with PHP4
i just went thru old backup files and found a line in my old .htaccess file i used for apache 1.3 with PHP4
AddType x-mapp-php4 .html .htm
AddType application/x-httpd-php .html .htm
removeHandler server-parsed htm html xhtml shtml
try - or GOOGLE and you'll fined - because you never mentioned what PHP version you use - hence that also is a factor to consider
if you need more help you have to give FULL details
best after your HTML code is clean
there surely is someone able to help you - waiting for your host to upgrade may be after your retirement
hans
Kriya Yoga | Secrets of Love | Photo gallery of the Philippine island