Hello everyone, I'm developing a real estate website, but I'm still a bit of a layperson in php, a friend of mine was helping me, but now he can not, the system I want is the following, let's say in my database has several properties registered and I need to only change the photo of the properties and still see the photos that I will send to the database and the folder before uploading the image. They know the facebook site type when we are going to edit the profile image for example and it shows us the right loaded image. How do I do this.
Note: I want to pre-view multiple, ie preview more than one photo.
<?php
session_start();
if (isset($_SESSION['usuario'])&&isset($_SESSION['logado'])) {
/*
paginas que adiciona fotos no imóvel
*/
//verifico se foi passado o ID do imóvel
if (!isset($_GET['id'])):
//Caso não voltar a pagina
echo '<div class="erro">Operação incorreta</div>';
header('Refresh: 1; ?pag=imoveis_fotos');
else:
$imv_id = $_GET['id'];
endif;
//verifico a quantidade de fotos que existe no imovel
$fotos = new Conexao();
$fotos->ExecSQL("select * from imoveis_fotos where foto_imovel =
'$imv_id'");
//tratando o limite de fotos
$limite = (Sistema::getLimiteFotos() - $fotos->TotalRegistros());
?>
<!--Scripts da biblioteca de upload de imagens-->
<script src="../lightbox/js/jquery-1.11.0.min.js"></script>
<script src="uploadify/jquery.uploadify.min.js"
type="text/javascript"></script>
<link rel="stylesheet" type="text/css"
href="uploadify/uploadify.css">
<div class="texto">
<p id="quem" style="margin-bottom:40px;">Adicionar imagens
</p>
<?php
echo '<center><div style="border:1px solid #000; width:500px;
margin-bottom:50px; font-weight:bolder;">Este imóvel tem ' .
$fotos->TotalRegistros() . ' imagens, o limite é ' .
Sistema::getLimiteFotos() . '.<br>Você pode enviar ainda: ' .
$limite . ' imagem(s)</div></center>';
if($limite < 1):
die('<div id="erro">O limite de imagem deste imóvel esgotou.
Caso queira outras imagens precisa apagar algumas.</div>');
endif;
?>
<script src="uploadify/jquery.uploadify.min.js"
type="text/javascript"></script>
<link rel="stylesheet" type="text/css"
href="uploadify/uploadify.css">
<center> <form>
<div id="queue"></div>
<input id="file_upload" name="file_upload" type="file"
multiple="true">
</form>
<script type="text/javascript">
<?php $timestamp = time();?>
$(function() {
$('#file_upload').uploadify({
'formData' : {
'imovel': '<?php echo $imv_id ;?>',
'timestamp' : '<?php echo $timestamp;?>',
'token' : '<?php echo md5('unique_salt' .
$timestamp);?>'
},
'swf' : 'uploadify/uploadify.swf',
'uploader' : 'uploadify/uploadify.php',
'buttonText': 'Selecionar arquivo',
'uploadLimit': <?php echo $limite ?>,
// depois de terminar
'onQueueComplete' : function(queueData) {
alert(queueData.uploadsSuccessful + ' Imagem (ns)
foram carregadas.');
url = '?pag=imoveis_fotos&id=<?php echo $imv_id
;?>';
$(location).attr("href",url);
} // fim do onQueueComplete
});
});
</script>
</center>
</div>
<a style="background: #73c425;
font-family:'OpenSans', sans-serif;
padding: 5px; margin-left: 10px;
font-size: 15px; text-transform:none;"
href="?pag=imoveis_fotos&id=<?php echo
$imv_id; ?>">Voltar</a>
<?php } else
{header("Location:login.php");} ?>