Ir para conteúdo
Fórum Script Brasil
  • 0

inserir imagem e mostrar imagem em um DB


kingsparda

Pergunta

Ola gente estou com um problema sou novato em javascript, e um amigo meu me mandou um codigo para inserir imagens em um banco de dados porem so tenho o DB e a pagina para mostrar as imagens no site porem perdi a de inserir as imagens no DB e a imagens quando vou na pagina fica apenas 1 pontinho branco na imagen se eu clicar nele abre a imagen mas como faço para mostrar a imagens em miniatura na pagina e ao clicar ele expandir vou mostrar o codigo

<div id="content_informations_home">
<?php echo $lang['text_page_media']; ?>

<br />
<?php
$menu = FALSE;

$np = 15; 
$pagina = sql($_GET["pagina"], TRUE); 
$pagina = empty($pagina) ? '1' : $pagina;

$pr = ($pagina*$np) - $np;
?>

 <script type="text/javascript">
     $('a:has(img)').lightbox();
 </script>
 <script>
$(document).ready(function(p){
	$("a[rel^='prettyPhoto']").prettyPhoto();
	$("a[rel^=prettyPhoto]").live("click",function() {
		$.prettyPhoto.open($(this).attr("href"),"","");
		return false;
	});



	$("input[id='val[]']").mask("99/99/9999 99:99:99");
	$("#data_vencimento").mask("99/99/9999");
	$("#data_expiracao").mask("99/99/9999 99:99:99");

	$('#qtd_credito').keyup(function() {

		$("#valor_total").html('R$'+Math.round((<?php echo $configs['valores']['credito']; ?> * $('#qtd_credito').val()) * 100) / 100);

	})
    xOffset=10; yOffset=20;
    $(".tooltip").hover(function(e){
        this.t=this.title;
        this.title="";
        $("body").append("<p id='tooltip'>"+ this.t +"</p>");
        $("#tooltip")
            .css("top",(e.pageY - xOffset) + "px")
            .css("left",(e.pageX + yOffset) + "px")
            .fadeIn("normal");
    },function(){
        this.title = this.t;
        $("#tooltip").remove();
    });
    $(".tooltip").mousemove(function(e){
        $("#tooltip")
            .css("top",(e.pageY - xOffset) + "px")
            .css("left",(e.pageX + yOffset) + "px");
    });
	
	$("#object")
		.css("top", ($(window).height()/2 - (80)) + "px")
		.css("left", ($(window).width()/2 - (80)) + "px")
		.slideDown(1500);
	


	  //close the message box when cross red image is clicked
		$("#close_message").click(function()
		{
			$("#object").slideUp("slow");
		});

	$('a[name=modal]').click(function(e) {
		e.preventDefault();
		
		var id = $(this).attr('href');
		var id_msgs = $(this).attr('id');
		var winH = $(window).height();
		var winW = $(window).width();
		
		$(id)
		.css('top',  winH/2 - ($(id).height()/2))
		.css('left', winW/2 - ($(id).width()/2));

		$('#msgs').html('<center>Aguarde...</center>');
		$(id).fadeIn(800); 
		$.post('loja_acao.php',
		{
			acao: 'ver_msgs',
			id: id_msgs
		},
		function(valor) {
		
			$('#msgs').html('').hide().html(valor).fadeIn(800);
		
			if( winH - 80 < winH/2 - ($(id).height()/2) + $(id).height() ) {
			
				$(id).animate({
					top: winH/2 - ($(id).height()/2) - 25
				 }, 600 )
				 
				 if( winH < $(id).height() ) {
					// alert( winH + ' - ' + $(id).height());
					
				 }

			}			
		});

		
	
	});
	
	$('.window .close').click(function (e) {
		e.preventDefault();
		$('.window').hide();
	});	
	
	

})
function MM_swapImgRestore() { //v3.0
  var i,x,a=document.MM_sr; for(i=0;a&&i<a.length&&(x=a[i])&&x.oSrc;i++) x.src=x.oSrc;
}
function MM_preloadImages() { //v3.0
  var d=document; if(d.images){ if(!d.MM_p) d.MM_p=new Array();
    var i,j=d.MM_p.length,a=MM_preloadImages.arguments; for(i=0; i<a.length; i++)
    if (a[i].indexOf("#")!=0){ d.MM_p[j]=new Image; d.MM_p[j++].src=a[i];}}
}

function MM_findObj(n, d) { //v4.01
  var p,i,x;  if(!d) d=document; if((p=n.indexOf("?"))>0&&parent.frames.length) {
    d=parent.frames[n.substring(p+1)].document; n=n.substring(0,p);}
  if(!(x=d[n])&&d.all) x=d.all[n]; for (i=0;!x&&i<d.forms.length;i++) x=d.forms[i][n];
  for(i=0;!x&&d.layers&&i<d.layers.length;i++) x=MM_findObj(n,d.layers[i].document);
  if(!x && d.getElementById) x=d.getElementById(n); return x;
}

function MM_swapImage() { //v3.0
  var i,j=0,x,a=MM_swapImage.arguments; document.MM_sr=new Array; for(i=0;i<(a.length-2);i+=3)
   if ((x=MM_findObj(a[i]))!=null){document.MM_sr[j++]=x; if(!x.oSrc) x.oSrc=x.src; x.src=a[i+2];}
}
</script>
<style>
.gallery .image-title,
.gallery .image-description,
.gallery .image-author,
.gallery .image-link {
	display:none;
}

.gallery
{
	width: 100%;
	text-align: left;
	margin-left: auto;
	margin-right: auto;
	padding: none;
}

.gallery ul.images
{
	list-style-type: none;
	border: none;
	padding: none;
}

.gallery ul.images li.image
{
	display: inline;
	line-height: 0;
}

.gallery ul.images li.image a
{
	text-decoration: none;
	color: inherit;
	cursor: pointer;
	margin: 5px;
	display: inline-block;
	background: white;
	padding: 3px;
	line-height: 0;
	-webkit-border-radius: 4px 4px;
	-moz-border-radius: 4px 4px;
	border-radius: 4px 4px;
	-moz-box-shadow: 0px 0px 8px #AAA;
	-webkit-box-shadow: 0px 0px 8px #AAA;
	box-shadow: 0px 0px 8px #AAA;
	-webkit-transition: -webkit-box-shadow 0.1s ease-out;
	-moz-transition: -webkit-box-shadow 0.1s ease-out;
	-o-transition: -webkit-box-shadow 0.1s ease-out;
	transition: -webkit-box-shadow 0.1s ease-out;
}

.gallery ul.images li.image a img
{
	border: none;
	padding: none;
	-webkit-border-radius: 4px 4px;
	-moz-border-radius: 4px 4px;
	border-radius: 4px 4px;
}

.gallery ul.images li.image a:hover
{
	-moz-box-shadow: 0px 0px 8px #222;
	-webkit-box-shadow: 0px 0px 8px #222;
	box-shadow: 0px 0px 8px #222;
}

.box-content {
text-align:center;
width:460px;	
}
#container {
position:relative;
float:left;
padding-left:15px;
padding-right:15px;
}
</style>
<div class="gallery">
 <ul class="images">
    
        <?php
		$sql = mysql_query("SELECT s.*, (SELECT char_name FROM characters WHERE charId = s.charId) AS char_name, DATE_FORMAT(data, '%d/%m/%Y') AS data FROM loja_screens s WHERE `status` = '1' ORDER BY s.id DESC  LIMIT $pr, $np") or die(mysql_error());
		$sql2 = mysql_query("SELECT s.*, (SELECT char_name FROM characters WHERE charId = s.charId) AS char_name, DATE_FORMAT(data, '%d/%m/%Y') AS data FROM loja_screens s WHERE `status` = '1' ORDER BY s.id DESC") or die(mysql_error());
		$contar = mysql_num_rows($sql2);
		$i = 1;
		while($c = mysql_fetch_array($sql)) {
			//$c['comentario'] = str_replace("\n", "<br>", $c['comentario']);
		?>	 
	 
             <li class="image"><a title="<br><br><br>Enviado por: <?php echo $c['char_name']; ?><br><br><?php echo htmlentities('Comentario'); ?>:<br><?php echo $c['comentario']; ?>" href="dashboard/screens/<?php echo $c['screen']; ?>" rel="prettyPhoto[pp_gal]" alt="Screen"><img src="dashboard/screens/mini_<?php echo $c['screen']; ?>" width="100" border="0"> </a></li>
		<?php 
		} 
		?>
</ul>
 <?php echo paginacao($contar, $_SERVER['REQUEST_URI'], $np, $pagina); ?>
</div>
<div id="container">
<div class="box-in">
  <div class="box-content">
  
 



 </div></div>
</div>
</div>
</div>

Tabela

SET FOREIGN_KEY_CHECKS=0;
-- ----------------------------
-- Table structure for loja_screens
-- ----------------------------
CREATE TABLE `loja_screens` (
  `id` int(11) NOT NULL AUTO_INCREMENT,
  `conta` varchar(255) NOT NULL,
  `charId` int(11) NOT NULL,
  `screen` text NOT NULL,
  `views` bigint(20) DEFAULT '0',
  `data` datetime NOT NULL,
  `comentario` text,
  `status` enum('0','1') DEFAULT '0',
  PRIMARY KEY (`id`)
) ENGINE=InnoDB AUTO_INCREMENT=3 DEFAULT CHARSET=latin1;

-- ----------------------------
-- Records 
-- ----------------------------
INSERT INTO `loja_screens` VALUES ('1', 'kingsparda', '268484242', 'b72ab1b05ad4e552d1bf3cf3285c48f4.jpg', '0', '2013-04-01 00:00:00', 'teste', '1');
INSERT INTO `loja_screens` VALUES ('2', 'kingsparda', '268484242', 'b72ab1b05ad4e552d1bf3cf3285c48f3.jpg', '0', '2013-11-14 13:55:50', 'teste', '1');

alguém me ajude por favor

OBRIGADO!

Editado por kingsparda
Link para o comentário
Compartilhar em outros sites

0 respostass a esta questão

Posts Recomendados

Até agora não há respostas para essa pergunta

Participe da discussão

Você pode postar agora e se registrar depois. Se você já tem uma conta, acesse agora para postar com sua conta.

Visitante
Responder esta pergunta...

×   Você colou conteúdo com formatação.   Remover formatação

  Apenas 75 emoticons são permitidos.

×   Seu link foi incorporado automaticamente.   Exibir como um link em vez disso

×   Seu conteúdo anterior foi restaurado.   Limpar Editor

×   Você não pode colar imagens diretamente. Carregar ou inserir imagens do URL.



  • Estatísticas dos Fóruns

    • Tópicos
      152,1k
    • Posts
      651,8k
×
×
  • Criar Novo...