6
I am mounting an image manager and I need to display these images on a TV, through the browser by a slideshow.
I can assemble a slide show setting each image address, but I have several images in DB, and would need to create an array of images to make the slideshow take these images from the image array I have in Mysql.
Follow my codes:
php (displays the image on the screen, is displaying one underneath the other)
<?
//CONECTA AO MYSQL
$conn = mysqli_connect("localhost", "root", "", "tv");
//EXECUTA A QUERY
$sql = mysqli_query($conn, "SELECT id_msg, img, departamento FROM mensagem");
echo "<h2>Exibe imagens cadastradas no BD</h2>";
while ($row = mysqli_fetch_row($sql)) {
$id = $row[0];
$bytes = $row[1];
$tipo = $row[2];
echo "<img src='gera.php?id_msg=".$id."' width='200' height='300' border='1'>";
echo "<br><br></div>";
}
?>
gera.php (generate all database images to be displayed by exibe.php
)
<?php
//RECEBE PARÂMETRO
$id = $_GET["id_msg"];
//CONECTA AO MYSQL
$conn = mysqli_connect("localhost", "root", "Sat3t3ll", "tv");
//EXIBE IMAGEM
$sql = mysqli_query($conn, "SELECT img FROM mensagem WHERE id_msg = ".$id."");
$row = mysqli_fetch_array($sql, MYSQLI_ASSOC);
//$tipo = $row["tipo"];
$bytes = $row["img"];
//EXIBE IMAGEM
header( "Content-type: image/gif");
echo $bytes;
?>
My idea would be to use this slideshow to display the array of images generated by exibe.php
<html>
<head>
<script src="jquery/jquery.js" type="text/javascript"></script>
<script src="jquery/jcycle.js" type="text/javascript"></script>
<script type="text/javascript">
<!--
$(function() {
$('#slideShow').cycle({ fx: 'fade' });
});
// -->
</script>
</head>
<body>
<div id="slideShow">
<img src="img/foto1.jpg" alt="Primeira Foto" width="300" height="200" />
<img src="img/foto2.jpg" alt="Segunda Foto" width="300" height="200" />
<img src="img/foto3.jpg" alt="Terceira Foto" width="300" height="200" />
</div>
</body>
</html>
The problem is to display the images(do not appear)? or only an image is shown in your example?
– rray
The images appear, the problem is that it takes the first image and applies the effect, in the others it is one on top of the other. I will post the code on the web. 1 min.
– Renato Souza
I’m having trouble getting online. See an example image: http://uploaddeimagens.com.br/imagens/capturr-jpg--663 In image 1 the effect is applied, but the other images are below. The idea would be to put all these images on top of each other and apply the slideshow effect. I’m using Cycle to make the slide.
– Renato Souza