преработване на скрипт - оразмеряване

lqlqlq

Registered
<script type="text/javascript">
var links=new Array();
var width=new Array();
var height=new Array();

<?php
include("config.php");
$dir=opendir("$directory");
$i=0;
while($file=readdir($dir)) {
$ext=strtolower(end(explode(".",$file)));
if($ext=="png" || $ext=="gif" || $ext=="jpeg" || $ext=="jpg") {
list($width,$height,$type,$attr)=getimagesize("$directory$file");
echo "links[$i]=\"$directory$file\";\n";
echo "width[$i]=$width;\n";
echo "height[$i]=$height;\n";
$i++;
}
}
closedir($dir);
?>
function $(div) {
return document.getElementById(div);
}
function loadImage() {
while(width[0]>screen.width-200 || height[0]>screen/height-200) {width[0]/=2; height[0]/=2;}
$('image').src=links[0];
$('image').style.left=screen.width/2-width[0]/2;
$('image').style.top=screen.height/2-height[0]/2-50;
$('image').style.width=width[0];
$('image').style.height=height[0];
}
var curr=0;
function next() {
if(curr==links.length-1) return;
curr++;
while(width[curr]>screen.width-200 || height[curr]>screen/height-200) {width[curr]/=2; height[curr]/=2;}
$('image').src=links[curr];
$('image').style.left=screen.width/2-width[curr]/2;
$('image').style.top=screen.height/2-height[curr]/2-50;
$('image').style.width=width[curr];
$('image').style.height=height[curr];
}
function previous() {
if(curr==0) return;
curr--;
while(width[curr]>screen.width-200 || height[curr]>screen/height-200) {width[curr]/=2; height[curr]/=2;}
$('image').src=links[curr];
$('image').style.left=screen.width/2-width[curr]/2;
$('image').style.top=screen.height/2-height[curr]/2-50;
$('image').style.width=width[curr];
$('image').style.height=height[curr];
}
function key() {
var keyid=event.keyCode;
if(keyid==37) {previous(); $('prevlink').style.color="#ffffff";}
if(keyid==39) {next(); $('nextlink').style.color="#ffffff";}
}
function key1() {
var keyid=event.keyCode;
if(keyid==37) $('prevlink').style.color="#00ffff";
if(keyid==39) $('nextlink').style.color="#00ffff";
}
</script>

Това е скрипт на една галерия която ползвам, от тук е, но някой може ли да ми преправи кода да ги оразмерява примерно на 500х500
Благодаря!
 
Просто погледни с какви размери ти прави снимките и после смени само числата. Дано не се заблуждавам само по този начин но предполагам че можеби ще стане :)
 
В този код никъде няма оразмеряване, снимките излизат такива каквито са, много големи и сайта се разширява и става грозно..
 

Back
Горе