Ir para conteúdo

Arquivado

Este tópico foi arquivado e está fechado para novas respostas.

Lucas AG

Slideshow

Recommended Posts

Olá pessoal do imasters boa noite eu estava criando um Slideshow deu certo mais a imagens não que aparecer ja verifiquei o diretorio

Me ajudem pfv Obrigado esse é o print.14061011435040734.jpg

 

Index.php

<?php

$dh = new DirectoryIterator ("imagens");
$files = array ();

foreach ($dh as $file){
	if(preg_match("/[.]jpg$/",$file))
	$files [] = "$file";
}

?>

<html>
<head>
<title> Slideshow </title>

<style>
body{ background:#999;}
#thumbnails{ height:140px; width:100%; overflow:auto;}
#pic{ text-align:center; height:400px; padding:20px;}
</style>

<script>
var image_list = [
<? $first = true;
foreach ($files as $image) {?>
<? echo($first ? : ","); ?>
"<? echo($image); ?>"
<? $first = false; } ?>
];

var curimage = 0;
function switchimg (ind){
	var image = image_list [ind];
	var obj = document.getElementById("selimg");
	obj.src = "scale.php?image="+image+"&y=400";
	curimage = ind;
}

function nextimage(){
	curimage++;
	
	if (curimage >= image_list.length)
	curimage = 0;
	switchimg (curimage);
}

window.setInterval("nextimage ()", 2000);
</script>
</head>
<body>

<div id="thumbnails">
<table width="100%">
<tr>
<?php $ind = 0; foreach($files as $image){ ?>
<td width="160" nowrap align="center">
<a href="javascript:switchimg(<? echo($ind); ?>)">
<img height="100" src="scale.php?image=<? echo($image); ?> &y=100" border="0"  />
</a> </td> <? $ind++; } ?>
</tr> </table> </div>

<div id="pic">
<img id="selimg" height="400" src="scale.php?image=<? echo($files[0]); ?> &y="400" >
</div>
</body>
</html>

scale.php

<?php

$image = $_GET["image"];
$maxy = $_GET["y"];
$im = @imagecreatefromjpeg ("imagens/". $image);
$curx = imagesx ($im);
$cury = imagesy ($im);
$ratio = $maxy / $cury;
$newx = $curx * $ratio;
$newy = $cury * $ratio;

$oim = imagecreatetruecolor($newx, $newy);
imageantialias ($oim, true);
imagecopyresized ($oim, $im, 0,0,0,0, $newx, $newy, $curx, $cury);

header ("content-type: image/jpeg");
imagejpeg($oim);

?>

As imagens esta em uma pasta normal com nome de imagens me ajudem pfv obrigado.

Compartilhar este post


Link para o post
Compartilhar em outros sites

Tente juntar, o > com o &

 

src="scale.php?image=<? echo($image); ?>&y=100"

Compartilhar este post


Link para o post
Compartilhar em outros sites

×

Informação importante

Ao usar o fórum, você concorda com nossos Termos e condições.