Foros del Web » Programando para Internet » PHP »

Abrir directamente

Estas en el tema de Abrir directamente en el foro de PHP en Foros del Web. Hola a todos. Me gustaría modificar la linea del scrip, que está en rojo, para que en vez de de pulsar para abrir, me abra ...
  #1 (permalink)  
Antiguo 19/06/2009, 02:33
 
Fecha de Ingreso: marzo-2009
Mensajes: 55
Antigüedad: 15 años
Puntos: 0
Abrir directamente

Hola a todos.
Me gustaría modificar la linea del scrip, que está en rojo, para que en vez de de pulsar para abrir, me abra la imagen directamente.

print "<tr>
<td align=\"center\"><a href=\"./$picturepath$picture \" target=\"_blank\"class=\"ninguna\"><align=\"center \"><img src=\"./photo/pdf.png\" border=\"0\"></a><br>";
}
else{
print "<tr>
<td align=\"center\"><a href=\"./$picturepath$picture \" target=\"_blank
\"class=\"ninguna\"><align=\"center\"><img src=\"$dest\" border=\"0\"></a><br>";
}

Me podeis ayudar?

Gracias.
  #2 (permalink)  
Antiguo 19/06/2009, 02:42
 
Fecha de Ingreso: abril-2003
Ubicación: Madrid
Mensajes: 65
Antigüedad: 21 años
Puntos: 2
Respuesta: Abrir directamente

Hola flatron666, que quieres decir con que te abra ¿directamente?.

- Que se muestre la imagen en automatico en una ventana nueva tal vez?

Saludos
  #3 (permalink)  
Antiguo 19/06/2009, 02:46
 
Fecha de Ingreso: marzo-2009
Mensajes: 55
Antigüedad: 15 años
Puntos: 0
Respuesta: Abrir directamente

Hola gracias por tu ayuda, si en automatico en una ventana nueva.
Puede ser?
Gracias
  #4 (permalink)  
Antiguo 19/06/2009, 03:09
 
Fecha de Ingreso: abril-2009
Ubicación: En dust 2
Mensajes: 149
Antigüedad: 15 años
Puntos: 2
Respuesta: Abrir directamente

Puedes poner un header que te abra otra página para mostrar la imagen
  #5 (permalink)  
Antiguo 19/06/2009, 03:22
 
Fecha de Ingreso: marzo-2009
Mensajes: 55
Antigüedad: 15 años
Puntos: 0
Respuesta: Abrir directamente

Hola he puesto esto y dá error.
<?php
header("Location: ./$picturepath$picture");

?>
Gracias
  #6 (permalink)  
Antiguo 19/06/2009, 03:34
 
Fecha de Ingreso: diciembre-2008
Mensajes: 118
Antigüedad: 15 años, 4 meses
Puntos: 6
Respuesta: Abrir directamente

puede que te falte un ponto o te sobre el que hay de la definicion para location, revísalo
  #7 (permalink)  
Antiguo 19/06/2009, 03:55
 
Fecha de Ingreso: marzo-2009
Mensajes: 55
Antigüedad: 15 años
Puntos: 0
Respuesta: Abrir directamente

Poniendole y quitandole sigue dando esto:Warning: Cannot modify header information - headers already sent by (output started at /usr/home/..........

Alguna idea.
Gracias
  #8 (permalink)  
Antiguo 19/06/2009, 03:58
 
Fecha de Ingreso: abril-2009
Ubicación: En dust 2
Mensajes: 149
Antigüedad: 15 años
Puntos: 2
Respuesta: Abrir directamente

Pon el código para que podamos ver mejor
  #9 (permalink)  
Antiguo 19/06/2009, 04:02
 
Fecha de Ingreso: marzo-2009
Mensajes: 55
Antigüedad: 15 años
Puntos: 0
Respuesta: Abrir directamente

Les pongo el codigo completo, lo que quiero es quitar los print y que se me abra la imagen directamente.

<?php
require("./NewsSql.inc.php");
$db = new NewsSQL($DBName);
if ((!empty($PR)) && ($Rating>=1)){
$db->set_Rating($newsid,$Rating);
}
$result = $db->getnewsbyid($newsid);
$title = $result[0]["title"];
$content = $result[0]["content"];
$picture = $result[0]["picture"];
$picturepath = "./photo/";
$viewnum = $result[0]["viewnum"];
$sourceurl = $result[0]["sourceurl"];
$source = $result[0]["source"];
$adddate = $result[0]["adddate"];
$db->addhit($viewnum,$newsid);
$Rate = $result[0]["rating"];
$Rate1 = $Rate*10;
$Rate2 = ceil($Rate1);
$Rate = $Rate2/10;


$pre[0] = $newsid-1;

for ($i=1; $i<=$prenumber-1; $i++){
$pre[$i] = $pre[$i-1]-1;
}

$next[0] = $newsid+1;

for ($i=1; $i<=$nextnumber-1; $i++){
$next[$i] = $next[$i-1]+1;
}

?>
<html>
<head>
<title><?php print "$title"; ?></title>
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
<link rel="stylesheet" href="style/style.css" type="text/css">

<script language="JavaScript">
<!--
function MM_reloadPage(init) { //reloads the window if Nav4 resized
if (init==true) with (navigator) {if ((appName=="Netscape")&&(parseInt(appVersion)==4)) {
document.MM_pgW=innerWidth; document.MM_pgH=innerHeight; onresize=MM_reloadPage; }}
else if (innerWidth!=document.MM_pgW || innerHeight!=document.MM_pgH) location.reload();
}
MM_reloadPage(true);
// -->
</script>
<style type="text/css">
<!--
body {
background-color: transparent;
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
body,td,th {
font-family: Geneva, Arial, Helvetica, sans-serif;
}
.rayitadebajo {
border-top-style: solid;
font-family: Arial, Helvetica, sans-serif;
border-top-width: thin;
border-top-color: #003333;
}
-->
</style>
</head>

<body text="#000000">
<table width="500" border="0" cellspacing="1" cellpadding="0" align="center" class="table_01">
<tr class="rayitadebajo">
<td width="594" valign="top" class="menu"><div align="left">
<?php
include("top.php3");
include_once("imageresize.class.php"); //para escalar

?>
</div></td>
</tr>
<tr class="rayitadebajo">
<td height="3" valign="top" class="rayitadebajo"><p align="justify"><span class="menu_in"><? print "$title"; ?></span></p> </td>
</tr>

<td colspan="2" align="center" valign="top" class="volver"><div align="center">
<table width="600" align="center" border="0" cellpadding="4" cellspacing="0">
<td align="center" valign="middle"></tr>

<?php
//comprobar imagen
$picture;
$imagen = explode(".",$picture);
$nombre = $imagen[0];
$extension = $imagen[1];
if($extension=="pdf"){
echo "";$mostrar='pdf.png';
}else{
$mostrar=$picture;
$source ="./photo/$mostrar"; // Escalado
$dest = 'tux_thumb.png'; // "
@unlink($dest); // "
$oResize = new ImageResize($source);// "
switch (width) {


case 'width':
$sTipo=sprintf("Por ancho:%d",400);

$oResize->resizeWidth(400);// cambiar aqui el ancho
break; // Fin de escalado



}
$oResize->save($dest);
}

// nuevo
$picture;
$imagen = explode(".",$picture);
$nombre = $imagen[0];
$extension = $imagen[1];
if($extension=="pdf"){

print "<tr>
<td align=\"center\"><a href=\"./$picturepath$picture \" target=\"_blank\"class=\"ninguna\"><align=\"center \"><img src=\"./photo/pdf.png\" border=\"0\"></a><br>";
}
else{
print "<tr>
<td align=\"center\"><a href=\"./$picturepath$picture \" target=\"_blank\"class=\"ninguna\"><align=\"center \"><img src=\"$dest\" border=\"0\"></a><br>";

}


//Rutina antigua

//if (!empty($picture)){

//print "<tr>
//<align=\"center\"><a href=\"./$picturepath$picture \" target=\"_blank\"class=\"ninguna\"><align=\"center \"><img src=\"$dest\" border=\"0\"></a><br>";

// }

if (!empty($content)){
$content = nl2br($content);
print "<tr>
<td class=\"texto\">$content</td>
</tr>";
}

if (!empty($sourceurl)){
print "<tr>
<td bgcolor=\"#F2F2F2\" class=\"fuente\">$front_source : $sourceurl</td>
</tr>
<tr>
<td><a href=\"$sourceurl\" class=\"fuente\" target=\"_blank\">$source</a></td>
</tr>";
}
else {
if (!empty($source)){
print "<tr>
<td bgcolor=\"transparent\" class=\"fuente\">$front_source : $sourceurl$source

<td></td>
</tr>";
}
}

if (!empty($adddate)){

print "<tr>
<td bgcolor=\"transparent\" class=\"fecha\">$front_adddate : $adddate</td>
</tr>
<tr>
<td></td>
</tr>";
}

for ($i=0; $i<=$prenumber-1; $i++){
$prename[$i] = $db->getname($pre[$i]);
if (!empty($prename[$i])){
$prenotemptytag = true;
}
}
for ($i=0; $i<=$nextnumber-1; $i++){
$nextname[$i] = $db->getname($next[$i]);
if (!empty($nextname[$i])){
$nextnotemptytag = true;
}
}
if (($prenotemptytag)||($nextnotemptytag)){
print "<tr>
<td bgcolor=\"#F2F2F2\" class=\"menu_in\">$front_more ...</td>
</tr>
<tr>
<td>";
for ($i=0; $i<=$prenumber-1; $i++){
if (!empty($prename[$i])){
print "<a href=\"news.php?newsid=$pre[$i]\" class=\"en_b\">$prename[$i]</a><br>";
}
}

for ($i=0; $i<=$nextnumber-1; $i++){
if (!empty($nextname[$i])){
print "<a href=\"news.php?newsid=$next[$i]\" class=\"en_b\">$nextname[$i]</a><br>";
}
}
print "</td>
</tr>";
}

?>

</table>
</div></td>
</tr>
</table>
<p>&nbsp;</p>
<p>&nbsp;</p>
</body>
</html>

Las lines rojas son las que tengo que sustituir para mostar la variable $picturepath$picture .
Gracias
  #10 (permalink)  
Antiguo 19/06/2009, 08:47
 
Fecha de Ingreso: abril-2003
Ubicación: Madrid
Mensajes: 65
Antigüedad: 21 años
Puntos: 2
Respuesta: Abrir directamente

Hola.

Perdona la tardanza, me voy a referir al error.

En ningun caso puedes meter nada en el codigo antes de la etiqueta

header("Location: ./$picturepath$picture");

es decir no puede haber ninguna emtietq <html><body> u otra.....

Prueba conesa pista
  #11 (permalink)  
Antiguo 19/06/2009, 10:07
 
Fecha de Ingreso: marzo-2009
Mensajes: 55
Antigüedad: 15 años
Puntos: 0
Respuesta: Abrir directamente


Nunca es tarde si la dicha es buena.
Estimado amigo, era eso; ahora funciona correctamente.

Muchisimas gracias a ti y a todos por la ayuda.
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 19:51.