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

Imagem não visualizada


FranChæs¿ng®

Pergunta

Olá, Galera PHP do ScriptBrasil

Desculpem, mas por favor, analisem este código abaixo e, se possível, me ajudem a descobrir por quê a imagem não é visualizada nesta consulta, conforme exemplo:

link_foto_quebrada.jpg

No código a seguir, em vermelho, está o href da foto. Muito grato pela ajuda.

<?php require_once('../../Connections/boletim_online.php'); ?>

<?php

session_start();

// Load the tNG classes

require_once('../../includes/tng/tNG.inc.php');

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

if (PHP_VERSION < 6) {

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

}

if (!function_exists("GetSQLValueString")) {

function GetSQLValueString($theValue, $theType, $theDefinedValue = "", $theNotDefinedValue = "")

{

if (PHP_VERSION < 6) {

$theValue = get_magic_quotes_gpc() ? stripslashes($theValue) : $theValue;

}

$theValue = function_exists("mysql_real_escape_string") ? mysql_real_escape_string($theValue) : mysql_escape_string($theValue);

switch ($theType) {

case "text":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "long":

case "int":

$theValue = ($theValue != "") ? intval($theValue) : "NULL";

break;

case "double":

$theValue = ($theValue != "") ? doubleval($theValue) : "NULL";

break;

case "date":

$theValue = ($theValue != "") ? "'" . $theValue . "'" : "NULL";

break;

case "defined":

$theValue = ($theValue != "") ? $theDefinedValue : $theNotDefinedValue;

break;

}

return $theValue;

}

}

$colname_RsTurno = "-1";

if (isset($_GET['turno'])) {

$colname_RsTurno = $_GET['turno'];

}

mysql_select_db($database_boletim_online, $boletim_online);

$query_RsTurno = sprintf("SELECT * FROM boletim_turno WHERE btr_id = %s", GetSQLValueString($colname_RsTurno, "int"));

$RsTurno = mysql_query($query_RsTurno, $boletim_online) or die(mysql_error());

$row_RsTurno = mysql_fetch_assoc($RsTurno);

$totalRows_RsTurno = mysql_num_rows($RsTurno);

$colname_RsSala = "-1";

if (isset($_GET['sala_id'])) {

$colname_RsSala = $_GET['sala_id'];

}

mysql_select_db($database_boletim_online, $boletim_online);

$query_RsSala = sprintf("SELECT sala_id, sala_nome FROM boletim_sala WHERE sala_id = %s", GetSQLValueString($colname_RsSala, "int"));

$RsSala = mysql_query($query_RsSala, $boletim_online) or die(mysql_error());

$row_RsSala = mysql_fetch_assoc($RsSala);

$totalRows_RsSala = mysql_num_rows($RsSala);

$colname_RsListaAlunos = "-1";

if (isset($_GET['sala_id'])) {

$colname_RsListaAlunos = $_GET['sala_id'];

}

$turno_RsListaAlunos = "-1";

if (isset($_GET['turno'])) {

$turno_RsListaAlunos = $_GET['turno'];

}

mysql_select_db($database_boletim_online, $boletim_online);

$query_RsListaAlunos = sprintf("SELECT user_id, user_nome, user_email, user_matricula, user_fotodoaluno, user_telefone, user_turno FROM boletim_usuarios WHERE user_sala_id = %s AND user_turno = %s ORDER BY user_nome ASC", GetSQLValueString($colname_RsListaAlunos, "int"),GetSQLValueString($turno_RsListaAlunos, "int"));

$RsListaAlunos = mysql_query($query_RsListaAlunos, $boletim_online) or die(mysql_error());

$row_RsListaAlunos = mysql_fetch_assoc($RsListaAlunos);

$totalRows_RsListaAlunos = mysql_num_rows($RsListaAlunos);

// Show Dynamic Thumbnail

$objDynamicThumb1 = new tNG_DynamicThumbnail("../../", "KT_thumbnail1");

$objDynamicThumb1->setFolder("../../imagens/fotosalunos/");

$objDynamicThumb1->setRenameRule("{RsListaAlunos.user_fotodoaluno}");

$objDynamicThumb1->setResize(50, 50, true);

$objDynamicThumb1->setWatermark(false);

$objDynamicThumb1->setPopupSize(800, 600, true);

$objDynamicThumb1->setPopupNavigation(false);

$objDynamicThumb1->setPopupWatermark(false);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns=http://www.w3.org/1999/xhtml">

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<title>Untitled Document</title>

<link href="../../tmp_css/mambo_admin/css/template_css.css" rel="stylesheet" type="text/css" />

</head>

<body>

<p> </p>

<div>

<table width="100%" border="0" cellpadding="2" cellspacing="2" class="adminlist" style="border-collapse:collapse;">

<tr>

<th><strong>Foto</strong></th>

<th><strong>Nome</strong></th>

<th><strong>E-mail</strong></th>

<th>Login / Matricula</th>

<th><strong>Telefone</strong></th>

<th>Gerenciar Notas</th>

</tr>

<?php if($row_RsListaAlunos['user_id] > 0) { ?>

<?php do { ?>

<tr>

<td><a href="<?php echo $objDynamicThumb1->getPopupLink(); ?>" onclick="<?php echo $objDynamicThumb1->getPopupAction(); ?>" target="_blank"><img src="<?php echo $objDynamicThumb1->Execute(); ?>" border="0" /></a></td>

<td><?php echo $row_RsListaAlunos['user_nome']; ?></td>

<td><?php echo $row_RsListaAlunos['user_email']; ?></td>

<td><?php echo $row_RsListaAlunos['user_matricula']; ?></td>

<td><?php echo $row_RsListaAlunos['user_telefone']; ?></td>

<td><!--<a style=cursor:pointer;" onclick="$('#visualizar_notas_<?php echo $row_RsListaAlunos['user_id]; ?>').load('boletim/visualizar_notas.php');">Visualizar</a> |--> <?php if($_SESSION['tipo_boletim'] == 1 && $_SESSION['tipo_recuperacao'] == 2) { ?><a href=index.php?boletim=adminnotas&user_id=<?php echo $row_RsListaAlunos['user_id]; ?>&sala=<?php echo $_GET['sala_id']; ?>">Gerenciar</a><?php } else if($_SESSION['tipo_boletim'] == 1 && $_SESSION['tipo_recuperacao'] == 1) { ?><a href=index.php?boletim=adminnotasrecpar&user_id=<?php echo $row_RsListaAlunos['user_id]; ?>&sala=<?php echo $_GET['sala_id']; ?>">Gerenciar</a><?php } else if($_SESSION['tipo_boletim'] == 2) { ?><a href=index.php?boletim=adminnotasem&user_id=<?php echo $row_RsListaAlunos['user_id]; ?>&sala=<?php echo $_GET['sala_id']; ?>">Gerenciar</a><?php } ?></td>

</tr>

<tr>

<td id=visualizar_notas_<?php echo $row_RsListaAlunos['user_id]; ?>" colspan="6"> </td>

</tr>

<?php } while ($row_RsListaAlunos = mysql_fetch_assoc($RsListaAlunos)); ?>

<?php } else { ?>

<tr><td colspan="6" align="center">

Nenhum aluno cadastado.

</td></tr>

<?php } ?>

</table>

</div>

</body>

</html>

<?php

mysql_free_result($RsTurno);

mysql_free_result($RsSala);

mysql_free_result($RsListaAlunos);

?>

Link para o comentário
Compartilhar em outros sites

4 respostass a esta questão

Posts Recomendados

  • 0
Da uma olhada na documentação dessa classe que você usa para exibir a miniatura.

Olá, Dedas. Fiz alteração no caminho e já está visualizando, ao clicar, apenas a imagem da POPUP, mas a imagem fixa THUMBNAIL (miniatura) continua não visualizando, conforme imagem de exemplo mostrada no início do tópico.

link_foto_quebrada.jpg

Mas a imagem está lá na pasta /imagens/fotosalunos/thumbnails/008535_50x50.JPG

$objDynamicThumb1 = new tNG_DynamicThumbnail("../../", "KT_thumbnail1"); = caminho antigo

$objDynamicThumb1 = new tNG_DynamicThumbnail("../", "KT_thumbnail1"); = novo caminho

Editado por FranChæs¿ng®
Link para o comentário
Compartilhar em outros sites

  • 0
A imagem do popup é igual a thumbnail ? Estão na mesma pasta ? Seria interessante você postar a classe, pois ficaria mais facil de te ajudar :)

Rapaz, o jeito vai ser você criar uma condição para essa barra ser exibida ou não :) Tenta ai, se não dé certo, ai posta logo os scripts para eu dar uma olhada :P

Abraço !

Olá, Dedas

Brother, o problema persiste em função do diretório está um nível acima. Tenho outro arquivo add_alunos.php que também tem esta mesma função de exibir thumbnail + popup e funciona 100% porém está um nível abaixo do diretório. Veja o exemplo:

boletim1/admin/add_alunos.php = funciona 100%

// Show Dynamic Thumbnail

$objDynamicThumb1 = new tNG_DynamicThumbnail("../", "KT_thumbnail1");

$objDynamicThumb1->setFolder("../imagens/fotosalunos/");

boletim1/admin/boletim/salas_alunos.php = Erro, esse é o problema

// Show Dynamic Thumbnail

$objDynamicThumb1 = new tNG_DynamicThumbnail("../", "KT_thumbnail1");

$objDynamicThumb1->setFolder("/../../imagens/fotosalunos/");

.

Abaixo o código original referente ao código acima modificando as (/) barras pra poder visualizar uma das imagens.

// Show Dynamic Thumbnail

$objDynamicThumb1 = new tNG_DynamicThumbnail("../../", "KT_thumbnail1");

$objDynamicThumb1->setFolder("../../imagens/fotosalunos/");

Note que salas_alunos.php está um nível acima de boletim1/admin

Veja nestes links no fomato .TXT os dois arquivos add_alunos.php e salas_alunos.php

Arquivo add_alunos.php

Arquivo sala_alunos.php

_______

Muito grato pela ajuda.

Link para o comentário
Compartilhar em outros sites

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...