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

Carregar Foto


PERNAMBUCO_FJV

Pergunta

<html>
<head>
<title>Script de Fotos</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="/includes/estilos/azul.css" rel="stylesheet" type="text/css"><style type="text/css">
<!--
.style4 {
	color: #FF0000;
	font-weight: bold;
	font-size: 10px;
}
.style5 {font-size: 10px}
-->
</style>
<script>
var escondido = 0;

function preview()
{
	img = document.getElementById('img');
	if(escondido)
	{
  esc.innerHTML = '<a href="javascript:;" class="menu style5" onclick="preview()">(esconder)</a><br><img onload="getSize()" width="500" src="'+escondido+'" name="img" id="img">';
  escondido = 0;
	}
	else
	{
  escondido = img.src;
  img.src = '';
  esc.innerHTML = '<a href="javascript:;" class="menu style5" onclick="preview()">(mostrar)</a><br><img onload="getSize()" src="1px.gif" name="img" id="img">';
	}
}

function find_array(arr,str)
{
	for(i=0; arr.length>i; i++)
	{
  if(arr[i] == str) return 1;
	}
	return 0;
}

function verificaFoto()
{
	var obj = document.getElementById('file');
	var v = obj.value;
	var extencao=v.substr(v.length - 4).toLowerCase();
	var extPerm = new Array(".gif",".jpg",".png","jpeg",".GIF",".JPG",".PNG","JPEG");
	var img = document.getElementById('img');
	img.src = "file://"+obj.value;
	img.width = 500;
	if(!find_array(extPerm,extencao))
	{ 
  alert("Só são permitidas fotos nos formatos GIF, PNG e JPG/JPEG");
  obj.value = "";
  esc.innerHTML = '<br><img onload="getSize()" src="1px.gif" name="img" id="img">';
  return 0;
	}

	escondido = img.src;
	if(escondido) preview();	
}

function getSize()
{
	if(document.getElementById('img').fileSize > 409600)
	{
  alert("A foto não pode ter mais de 400 KB.");
  esc.innerHTML = '<br><img onload="getSize()" src="1px.gif" name="img" id="img">';
  obj.value = "";
  return 0;
	}
	return 1;
}
</script>
</head>

<body leftmargin="0" topmargin="0" marginwidth="0" marginheight="0">
<div id="Layer1" style="position:absolute; left:40%; top:-350px; width:300px; height:150px; z-index:1">
  <table width="300" border="0" cellpadding="0" cellspacing="0" class="tabelaborda">
    <tr>
      <td height="20" colspan="3" class="tabelatopo">&nbsp;AGUARDE...</td>
    </tr>
    <tr>
      <td height="10" colspan="3"><img src="1px.gif" width="1" height="1"></td>
    </tr>
    <tr>
      <td width="10" rowspan="2">&nbsp;</td>
      <td width="280" align="center" valign="middle" class="verdana12"><div align="justify">Aguarde enquanto a foto está sendo enviada. Isto pode levar alguns segundos. <strong>Não pare este processo.</strong>
      </div>
      <td width="10" rowspan="2">&nbsp;</td>
    </tr>
    <tr>
      <td height="12" colspan="3" class="noticialink"><img src="1px.gif" width="1" height="1"></td>
    </tr>
  </table>
</div>
<table width="776" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr> 
    <td height="10" colspan="3"><img src="1px.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td height="10" colspan="3"><img src="1px.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td width="133" align="left" valign="top"></td>
    <td width="510" align="center" valign="top" class="texto"> <div id="result" style="width: 70%;" class="style4"></div>
      <table width="510" border="0" cellpadding="0" cellspacing="5">
        <form>
          <input type="hidden" name="MAX_FILE_SIZE" value="1048576" />
          <tr> 
            <td valign="top"> <p class="texto">Selecione a foto<br>
                <input type="file" id="file" onchange="verificaFoto()" name="file"  />
              </p></td>
          </tr>
          <tr> 
            <td valign="top" class="texto">Pré-visualização: 
              <label id="esc"><br>
              <img src="1px.gif" name="img" id="img"></label></td>
          </tr>
        </form>
      </table>
      <br> <iframe width="0" height="0" frameborder="0" name="destForm"></iframe> 
    </td>
    <td width="133" align="right" valign="top"> <table width="100%" height="10"  border="0" cellpadding="0" cellspacing="0">
        <tr> 
          <td><img src="1px.gif" width="1" height="1"></td>
        </tr>
      </table></td>
  </tr>
  <tr> 
    <td height="10" colspan="3"><img src="1px.gif" width="1" height="1"></td>
  </tr>
  <tr> 
    <td height="10" colspan="3" align="left" valign="top"><img src="1px.gif" width="1" height="1"></td>
  </tr>
</table>
</body>
</html>

ae crie uma "1px.gif" toda branca!!

Link para o comentário
Compartilhar em outros sites

3 respostass a esta questão

Posts Recomendados

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
      152k
    • Posts
      651,7k
×
×
  • Criar Novo...