picture-navigator

Gesponsorde koppelingen

PHP script bestanden

  1. picture-navigator

« Lees de omschrijving en reacties

================== conf.php============================= al het 'denk' werk

Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<?PHP
// config
// cfg -------------

$cfg['width']    = '300'; // breedte van het vlak
$cfg['height']    = '300'; // hoogte van het vlak
$cfg['pl']        = 'f22.jpg'; // het plaatje
$cfg['stap']    = '150'; // pixels perkeer
$cfg['klein']    = '1'; // 1 voor wel miniatuur en 0 voor niet
$cfg['z']        = '0.5'; // Per keer uitzoomen
//---------------------------------------------- alle functies

class func {
 // inladen
function res($filename){  // van img2pix
if(@imagecreatefromjpeg($filename)){
        return imagecreatefromjpeg($filename);    
    }

    elseif(@imagecreatefromgif($filename)){
        return imagecreatefromgif($filename);    
    }

    elseif(@imagecreatefrompng($filename)){
        return imagecreatefrompng($filename);    
    }

    elseif(@imagecreatefromwbmp($filename)){
        return imagecreatefromwbmp($filename);    
    }
}
function
size($pl) {
$siz = getimagesize($pl);
return $siz;
}

//------------ zoom
function map($pl,$w,$h,$x1,$y1,$keer,$s) {
$xas = ($keer >1) ? $x1-(($w/2)*($keer-1)) : $x1; // stomme () :P
$yas = ($keer >1) ? $y1-(($h/2)*($keer-1)) : $y1;
$siz = $this->size($pl);
$ima = $this->res($pl);
$im = imagecreatetruecolor($w,$h);
$bg = imagecolorallocate($im,0,0,0);
$image = imagecopyresized($im,$ima,0,0,$xas,$yas,$w,$h,($w*$keer),($h*$keer));
header('Content-type: image/png');
imagepng($im);
imagedestroy($im);
imagedestroy($ima);
}
function
mini($pl,$x1,$y1,$w1,$h1,$k) {
$x = ($k >1) ? $x1-(($w1/2)*($k-1)) : $x1;
$y = ($k >1) ? $y1-(($h1/2)*($k-1)) : $y1;
$h = $h1*$k;
$w = $w1*$k;
$ima = $this->res($pl);
$siz = $this->size($pl);
$g = ($siz[0] > 1000 || $siz[1] > 1000) ? 10 : 5;
$wid = round($siz[0]/$g,0);
$hei = round($siz[1]/$g,0);
//---------------------------------
$img = imagecreatetruecolor($wid,$hei);
imagecopyresampled($img,$ima,0,0,0,0,$wid,$hei,$siz[0],$siz[1]);
$color1 =imagecolorallocate($img,255,119,1);
imagerectangle($img,round($x/$g,0),round($y/$g,0),round(($x+$w)/$g,0),round(($y+$h)/$g,0),$color1);
header('Content-type: image/png');
imagepng($img);
imagedestroy($img);
}

//einde class
}
$data = new func;
?>

===================== map.php ================== Aanroep bestand
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<?PHP
include("conf.php");
//--------------
$siz = $data->size($cfg['pl']);
$x = (isset($_GET['x']) && $_GET['x'] >= 0 && ($_GET['x']+$cfg['stap']) <= $siz[0]) ? $_GET['x'] : '0';
$y = (isset($_GET['y']) && $_GET['y'] >= 0 && ($_GET['y']+$cfg['stap']) <= $siz[1]) ? $_GET['y'] : '0';
$k = (isset($_GET['k']) && $_GET['k'] >0) ? $_GET['k'] : '1';
if(is_numeric($_GET['k']) && is_numeric($_GET['x']) && is_numeric($_GET['y']) && $_GET['v'] == 'v') {
$data->map($cfg['pl'],$cfg['width'],$cfg['height'],$x,$y,$k,$cfg['stap']);
}
elseif(is_numeric($_GET['k']) && is_numeric($_GET['x']) && is_numeric($_GET['y']) && $_GET['v'] == 'k' && $cfg['klein'] == 1) {
$data->mini($cfg['pl'],$x,$y,$cfg['width'],$cfg['height'],$k);
}


?>

==================== index.php =================== opmaak
<html><head><meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"><title>Picture viewer</title><head>
<style>
BODY {
font-family:Arial,Verdana;
font-size:10px;
background-color:#ffffff;
margin-left:0px;
margin-top:0px;
}
INPUT, SELECT, TEXTAREA {
border: 2px solid #DADBDC;
color:black;
font-size : 10px;
font-family : Arial, verdana;
}
TABLE.MAIN {
border: 2px solid #DADBDC;
font-size : 14px;
font-family : Arial, verdana;
color:black;
text-decoration: bold;
}
A:link {color: black; font-size: 13px; font-family : Arial, verdana; text-decoration: bold;}
A:active {color: black; font-size: 13px; font-family : Arial, verdana; text-decoration: bold;}
A:visited {color: black; font-size: 13px; font-family : Arial, verdana; text-decoration: bold;}
A:hover {color: black; font-size: 13px; font-family : Arial, verdana; text-decoration: bold;}
</style></head><body><center><br />
Code (php)
PHP script in nieuw venster Selecteer het PHP script
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
<?PHP
include("conf.php");
//------------
$siz     = getimagesize($cfg['pl']);
$x = (isset($_GET['x']) && $_GET['x'] >= 0 && ($_GET['x']+$cfg['stap']) <= $siz[0]) ? $_GET['x'] : 0;
$y = (isset($_GET['y']) && $_GET['y'] >= 0 && ($_GET['y']+$cfg['stap']) <= $siz[1]) ? $_GET['y'] : 0;
$k = (isset($_GET['k']) && $_GET['k'] >0) ? $_GET['k'] : 1;
$s = $cfg['stap']*$k;
$ke = ($k-1 >= 1) ? $k-$cfg['z'] : 1;
$minx    = ($x <=0 || ($x-$S) <= 0) ? 0 : ($x-$s);
$plux     = ($x > $siz[0] || ($x+$s) > $siz[0]) ? $x : ($x+$s);
$miny     = ($y <=0 || ($y-$S) <= 0) ? 0 : ($y-$s);
$pluy     = ($y > $siz[1] || ($y+$s) > $siz[1]) ? $y : ($y+$s);
//=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-==-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=
// form
// opmaak

echo "<table><tr><th colspan=2></th></tr>";
echo "<tr><td>";
echo "<table cellpadding=0 cellspacing=0 CLASS='main'>";
echo "<tr style='height: 17px;' ><td width='17' >";
//links boven
echo "<a href='".$_SERVER['PHP_SELF']."?x=".$minx."&y=".$miny."&k=".$k."'><img src='img/l_b.gif' border=0 /></a>";
echo "</td><td align='center'>";
//boven
echo "<a href='".$_SERVER['PHP_SELF']."?x=".$x."&y=".$miny."&k=".$k."'><img src='img/b.gif' border=0 /></a>";
echo "</td><td width='17'>";
//rechts boven
echo "<a href='".$_SERVER['PHP_SELF']."?x=".$plux."&y=".$miny."&k=".$k."'><img src='img/r_b.gif' border=0 /></a>";
echo "</td></tr>";
echo "<tr><td>";
// links
echo "<a href='".$_SERVER['PHP_SELF']."?x=".$minx."&y=".$y."&k=".$k."'><img src='img/l.gif' border=0 /></a>";
echo "</td><td>"; // midden
echo "<img src='map.php?x=".$x."&y=".$y."&k=".$k."&v=v' width='300' height='300' alt='Map'/>";
echo "</td><td>";
// rechts
echo "<a href='".$_SERVER['PHP_SELF']."?x=".$plux."&y=".$y."&k=".$k."'><img src='img/r.gif' border=0 /></a>";
echo "</td></tr>";
echo "<tr style='height: 17px;' ><td>";
// links onder
echo "<a href='".$_SERVER['PHP_SELF']."?x=".$minx."&y=".$pluy."&k=".$k."'><img src='img/l_o.gif' border=0 /></a>";
echo "</td><td align='center'>";
// onder
echo "<a href='".$_SERVER['PHP_SELF']."?x=".$x."&y=".$pluy."&k=".$k."'><img src='img/o.gif' border=0 /></a>";
echo "</td><td>";
// rechts onder
echo "<a href='".$_SERVER['PHP_SELF']."?x=".$plux."&y=".$pluy."&k=".$k."'><img src='img/r_o.gif' border=0 /></a>";
echo "</td></tr>";
//zoom
echo "<table>";
echo "<table width='".$cfg['width']."'><tr><td align=center><a href='".$_SERVER['PHP_SELF']."?x=".$x."&y=".$y."&k=".($k+$cfg['z'])."'>Zoom Uit</a> - <a href='".$_SERVER['PHP_SELF']."?x=".$x."&y=".$y."&k=".$ke."'>Zoom In</a> - ";
echo "<a href='".$_SERVER['PHP_SELF']."?x=".$x."&y=".$y."&k=1'>Reset</a></td></tr>
</table></td><td><table class='main'><tr><td align=center>Kaart:</td></tr>"
;
if($cfg['klein'] == 1) {
echo "</table></td><td><table class='main'><tr><td align=center>Kaart:</td></tr>";
echo "<tr><td><img src='map.php?x=".$x."&y=".$y."&k=".$k."&v=k' /></td></tr>";
echo "</table></td></tr>";
}

echo "</table></td></tr>";
// anders zooi
?>

</center></body></html>

 
 

Om de gebruiksvriendelijkheid van onze website en diensten te optimaliseren maken wij gebruik van cookies. Deze cookies gebruiken wij voor functionaliteiten, analytische gegevens en marketing doeleinden. U vindt meer informatie in onze privacy statement.