Member
Member
bill61   2008-04-13, 07:23
#1

hi

can anyone help me How to include Random image or video into HTML page ??

regards

Administrator
Member
Member
bill61   2008-04-13, 09:19
#3

hi acrylian

i did not get 100%

i am not that good with php files.

my zendphoto folder are inside my site folder directory_path.

i need to have a box of random images and another one for video.

the page is html so what is the html code should i use to execute the random image or video from the zendphoto??

regards

Administrator
Administrator
acrylian   2008-04-13, 09:43
#4

You need a php file, meaning a file with .php as suffix to execute php functions. On a .html page that will not work because the server won't recognize it as php. You can just rename your .hml file to .php. That does not really matter.

Try adding the code here http://www.zenphoto.org/2008/01/hacks/#zenphoto-as-plugin

I hope that helps a little more.

Member
Member
bill61   2008-04-13, 10:19
#5

hi acrylian

how about if i create a php file like:

Administrator
Administrator
acrylian   2008-04-13, 10:35
#6

No. Why don't you just rename your .html file? That does not make any difference for the html part of that file.

Member
Member
bill61   2008-04-13, 10:38
#7

hi

if i rename the file to php is that all i have to insert into the box where i want the random image to show:

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

$randomImage = getRandomImages();
$randomImageURL = getURL($randomImage);
echo "';

regards

Administrator
Administrator
acrylian   2008-04-13, 10:57
#8

the define and the require_once should be on top of the file, the other code should go where you want the random image.
php code within a html code must always be enclosed in .

Member
Member
bill61   2008-04-13, 11:10
#9

hi acrylian

so inside the php file the script should looks like:

on top:

Member
Member
bill61   2008-04-13, 14:35
#10

hi acrylian

sorry, inside the php file the script should looks like:

Administrator
Administrator
acrylian   2008-04-13, 17:37
#11

Your post before your last should work.

Member
Member
bill61   2008-04-14, 07:56
#12

hi acrylian

the script working 100% but to include Random images or videos into my home website is a nughtmare.

unfortanatly, i can not change the file name from html into php. this is how the site was developed.

can u find me another solution for this html issue pls?

regards

Administrator
Administrator
acrylian   2008-04-14, 08:44
#13

No, sorry.

Member
Member
bill61   2008-04-14, 09:05
#14

hi acrylian

ok, i will give it another shot and try something else.

first i need to meke sure of this bellow:

define('ZENFOLDER', 'zp-core'); (for this one what folder they mean in this)

define('WEBPATH', 'zenphoto'); (for this one what path they mean in this)

require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php"); (for this one what folder they mean in this)

Administrator
Administrator
acrylian   2008-04-14, 10:01
#15

[i]define('ZENFOLDER', 'zp-core'); (for this one what folder they mean in this)[/i]
the zp-core folder within you zenphoto installation

[i]define('WEBPATH', 'zenphoto'); (for this one what path they mean in this)[/i]
the folder of your zenphoto installation, you have of course to change that if you renamed it.

[i]require_once(WEBPATH . "/" . ZENFOLDER . "/template-functions.php"); (for this one what folder they mean in this)[/i]
The ones you defined above...

Member
Member
bill61   2008-04-14, 11:12
#16

hi acrylian

nothing seems to work

hope in the next version they take care of how or a simple way to " include Random image or video into HTML pages"

thanks

Administrator
Administrator
acrylian   2008-04-14, 12:10
#17

As I said above php code does not work on .html pages. You need to use a .php file. This is not a zenphoto issue.

Member
Member
AlexWilson   2008-04-14, 14:03
#18

try

AddType application/x-httpd-php .html

in your .htaccess file

Or even

`

AddType application/x-httpd-php .html

`

to make it just process PHP for a specific file.

Alternatively, you can put rewrite rule in .htaccess to internally redirect the call to the .html URL to your .php version.

RewriteRule ^example.html$ example.php [L]

If you can't change your .htaccess, or your host doesn't let use AddType or rewrites, then you might be stuck. The only other thing I could think of would be to get the HTML page to redirect to the PHP pages -- either with a meta refresh tag or some document.location JavaScript.

And as an absolute last option, you can have a random image picked and displayed solely by JavaScript. This would requiring you updating the page each time you want to change the list of possible images it picks from, though.

Lots of options

Member
Member
bill61   2008-04-24, 04:09
#19

hi AlexWilson

thanks for your reply

i am not that familiar with php.

however, the htaccess file for my website i can open it from my ftp no problems.

can u pls guide me step by step how to go in this process to get the random working on my html page.

the : zenphoto folder in this case named : mediabox.

also is it possible to have random for specific folders in the album??

thanks

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