Follow along with the video below to see how to install our site as a web app on your home screen.
Бележка: This feature may not be available in some browsers.
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN" >
<html>
<head>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
</head>
<body>
<div id="html1" style="position:absolute; overflow:hidden; left:0px; top:0px; width:603px; height:377px; z-index:0">
<base target="_blank">
<script language="JavaScript">
</script>
</div>
</body>
</html>
#! /usr/local/bin/perl
##############################################################################
# Basic Random Image Displayer Version 1.2 #
# Copyright 1996 Matt Wright mattw@worldwidemart.com #
# Created 7/1/95 Last Modified 7/20/95 #
# Scripts Archive at: http://www.worldwidemart.com/scripts/ #
##############################################################################
# COPYRIGHT NOTICE #
# Copyright 1996 Matthew M. Wright All Rights Reserved. #
# #
# Basic Random Image may be used and modified free of charge by anyone so #
# long as this copyright notice and the comments above remain intact. By #
# using this this code you agree to indemnify Matthew M. Wright from any #
# liability that might arise from it's use. #
# #
# Selling the code for this program without prior written consent is #
# expressly forbidden. In other words, please ask first before you try and #
# make money off of my program. #
# #
# Obtain permission before redistributing this software over the Internet or #
# in any other medium. In all cases copyright and header must remain intact.#
##############################################################################
# Necessary Variables
$basedir = "http://your.host.xxx/images/";
@files = ("first_image.gif","test.gif","random.gif","neat.jpg");
# Options
$uselog = 0; # 1 = YES; 0 = NO
$logfile = "/home/mattw/public_html/image/pics/piclog";
# Done
##############################################################################
srand(time ^ $$);
$num = rand(@files); # Pick a Random Number
# Print Out Header With Random Filename and Base Directory
print "Location: $basedir$files[$num]\n\n";
# Log Image
if ($uselog eq '1') {
open (LOG, ">>$logfile");
print LOG "$files[$num]\n";
close (LOG);
}
<?php
#Set the following configuration variable
#$imagedir is the directory that holds your images.
#Be SURE to include the trailing slash in the name.
$imagedir = "images/";
#########################################################
#Editing below is not required. #
#########################################################
$images = array();
#Locate and all of the existing images
$directory = opendir($imagedir);
while($filename = readdir($directory)){
if(strlen($filename) > 2){ #ignore . and ..
$localext = substr($filename, -3);
if(!((strcasecmp($localext, "gif") == 0) || (strcasecmp($localext, "jpg") == 0) || (strcasecmp($localext, "bmp") == 0) || (strcasecmp($localext, "png") == 0)))
continue;
array_push($images, $filename);
}
}
#choose a random image from the array
srand((double)microtime() * 1000000);
$selection = $images[rand(0, sizeof($images)-1)];
#display the imaeg
echo "<img src=\"$imagedir$selection \" alt=\"$selection (" . filesize("$imagedir/$selection") . " bytes)\">";
?>
Nathan каза:Уооооу, знам че темата е старичка - 2 години и е лошо да я събуждам, ама ми трябва нещо относно php кода за random image.
Как мога да направя така, че всеки банер да бъде връзка към отделни сайтове? Трябва ми в php!
<?php
class banner_rotator {
var $banner = array();
var $total_percent=0;
function add_banner($image,$url,$percent) {
$this->total_percent=$this->total_percent+$percent;
for ($i=0; $i<=$percent; $i++) {
$this->banner[]=array('image'=>$image, 'url'=>$url);
}
}
function random_baner() {
$rand_key = array_rand($this->banner, 1);
if ($this->total_percent!=100) return "Error: obshtiq sbor procenti za tozi rotator e razlichen ot 100%!\n";
return '<a href="'.$this->banner[$rand_key]['url'].'"><img src="'.$this->banner[$rand_key]['image'].'"></a>'."\n";
}
}
$b['top']=new banner_rotator;
$b['top'] -> add_banner('image1','url1','80');
$b['top'] -> add_banner('image2','url2','10');
$b['top'] -> add_banner('image3','url3','5');
$b['top'] -> add_banner('image4','url4','5');
$b['right']=new banner_rotator;
$b['right'] -> add_banner('image5','url5','30');
$b['right'] -> add_banner('image6','url6','20');
$b['right'] -> add_banner('image7','url7','25');
$b['right'] -> add_banner('image8','url8','25');
//pokazvane na baner 'TOP'
echo $b['top'] ->random_baner();
//pokazvane na baner 'RIGHT'
echo $b['right'] ->random_baner();
?>
на мястото на img слагаш линк към картинкатаNathan каза:Ъъъъм мерси, ама малко се обърквам. На мястото на image# пускам URL на банера, а на мястото на url# пускам URL на сайта.
А какви са тия цифри после? Защо са top и right? Не може ли да е само една група банери, а не няколко по четири?