Página 5 de 7

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 27 Feb 2010, 12:07
por teto86
ok!! muchas gracias lo mirare haber.

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 08 Abr 2010, 21:40
por teto86
Hola, pues tengo un problema ya despues de mucho tiempo usando con completa normalidad el servidor de imagenes, y esque ayer mismo hice un traspaso de servidor, y cuando voy a subir una foto, me sale todo perfecto, igual que antes, le doy a examinar, busco mi foto en mi ordenador y cuendo le doy a subir me aparece este error.
Imagen

No se si tendra algo que ver con el cambio de servidor pero desde luego que a sido a raiz de eso el error.

El cambio a sido de piensasolutions a evalice.

Tengo que añadir que en pienasolutions la carpeta visible era html y en evalice ahora es public_html no se si tendra algo que ver, pero yo lo comento por si acaso... aunque tambien es cierto que la carpeta visible del servidor no la escribi en ningun momento, todo era a partir de esa carpeta...

Alguien sabe que a podido pasar???

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 08 Abr 2010, 21:44
por engendro666
a mi me dio el mismo error cuando instale este servidor (por cierto exelent el aporte) sinceramente no recuerdo como lo solucione, pero la solucion la saque de uno de los mensajes de este tema, revisa desde la hoja uno vas a ver que hay varias soluciones a problemas una habla sobre el mime_content_type creo que era cosa de cambiar esa funcion, en todo caso proba todas las soluciones que se dan en los mensajes de este mismo tema

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 08 Abr 2010, 21:45
por xoom
Si has cambiado el servidor, lo más probable es que varíe esa ruta y ahora no tenga public_html

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 08 Abr 2010, 23:28
por ahh72
mirate las rutas que te indica que se agregan y puede que ahi encuentres la solucion a tu problema :wink:

saludos

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 13 Abr 2010, 23:43
por teto86
No doy con ello, e hecho todo lo que hay an todas la paginas anteriores y nada... donde mas me e centrado a sido en la segunda hoja del tema. http://www.phpbb-es.com/foro/recursos-w ... 07-10.html

Hay un par de compañeros que lo han solucionado pero no han puesto como... :( e probado lo la pagina 2 de este tema pero no se donde exactamente hay que pegar el codigo que ponen. alguien podria hecharme una mano?

el error que me da este:

Imagen

Y mi archivo imagehosting.php es asi.

Código: Seleccionar todo

<?php 
$varrand = substr(md5(uniqid(rand())),0,10);		
$varallw = array("image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/x-png");
$varpath = "http://clubrenaultgt.com/foro/galeria/tmp/";
$varstat = "";

if ($_POST["action"] == "upload") {
	if (is_uploaded_file($_FILES["imagen"]["tmp_name"])) {
		$varname = $_FILES["imagen"]['name'];
		$vartemp = $_FILES['imagen']['tmp_name'];
		$vartype = mime_content_type($vartemp);
		
		if (in_array($vartype, $varallw) && $varname != "") {
			$arrname = explode(".", $varname);
			$varname = $varrand.".".$arrname[1];
			if (copy($vartemp, "tmp/".$varname)) {
				$varpath = $varpath.$varname;
				$varstat = "ok";
			} else {
				$varstat = "Error al subir el archivo";
			}
		} else {
			$varstat = "Archivo no valido";
		}
	}
}
?>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Subir imagen al ClubRenaultGT</title>
<link href="cssupload.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="420" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="413" height="40" class="titulo">ClubRenaultGT<img src="http://clubrenaultgt.com/foro/galeria/tmp/81f4addf36.jpg"></td>
  </tr>
  <tr>
    <td class="text">Aloja tu imagen con formatos gif, bmp, jpeg, png, en nuestro servidor de ClubRenaultGT:</td>
  </tr>
  <tr>
  <form action="imagehosting.php" method="post" enctype="multipart/form-data">
    <td height="50" valign="top" class="text">
      <input name="imagen" type="file" class="casilla" id="imagen" size="35" />
      <input name="enviar" type="submit" class="boton" id="enviar" value="Subir Imagen" />
	  <input name="action" type="hidden" value="upload" />	  </td>
	</form>
  </tr>
  <?php if ($varstat == "ok") { ?>
  <tr>
    <td class="textinf"><strong>Confirmaci&oacute;n:</strong><br>
	Archivo publicado satisfactoriamente. Puedes utilizar las siguientes opciones para enlazarlo:<br>
	<br>
	<strong>Enlace BBCode para poner la imagen en el foro:</strong> <br>
	<input name='txt1' type='text' value='[img]<?php echo $varpath; ?>[/img]' size='60'>
	<br>
	<strong>Enlace BBCode para crear diapositivas de todas las imagenes de tu post:</strong> <br>
	<input name='txt1' type='text' value='[slideshow=grupo1]<?php echo $varpath; ?>,Sin titulo[/slideshow]' size='60'>
	<br>
	<strong>Enlace Directo: </strong><br>
	<input name='txt2' type='text' value='<?php echo $varpath; ?>' size='60'></td>
  </tr>
  <?php } else { ?>
	  <?php if ($varstat != "") { ?>
	  <tr>
		<td class="textinf"><strong>Error:</strong><br>
	    <?php echo $varstat; ?>&nbsp;</td>
	  </tr>
	  <?php } ?>
  <?php } ?>
</table>
<?php if ($varstat == "ok") { ?>
<p align="center"><img src="tmp/<?php echo $varname; ?>"></p>
<?php } ?>
<?php if ($_GET['image'] != "") { ?>
<p align="center"><img src="tmp/<?php echo $_GET['image']; ?>"></p>
<?php } ?>
</body>
</html>
espero que me podais ayudar.

Muchas gracias y un saludo.

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 15 Abr 2010, 22:08
por teto86
No me gusta hacer esto, y no suelo hacerlo... pero nadie me puede hechar una mano????

Muchas gracias.

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 16 Abr 2010, 15:45
por teto86
ator_18 escribió:He encontrado un codigo en internet que segun parece te crea la funcion de la que te hable, el codigo es el siguiente:
La fuente es es.php.net y su autor serkanyersen

Intentalo con ese codigo, ten encuenta que la funcion se llama get_mime y no mime_content_type, espero que te sea util.

Código: Seleccionar todo

<?
/**
 * Tries to get mime data of the file.
 * @return {String} mime-type of the given file
 * @param $filename String
 */
function get_mime($filename){
    preg_match("/\.(.*?)$/", $filename, $m);    # Get File extension for a better match
    switch(strtolower($m[1])){
        case "js": return "application/javascript";
        case "json": return "application/json";
        case "jpg": case "jpeg": case "jpe": return "image/jpg";
        case "png": case "gif": case "bmp": return "image/".strtolower($m[1]);
        case "css": return "text/css";
        case "xml": return "application/xml";
        case "html": case "htm": case "php": return "text/html";
        default:
            if(function_exists("mime_content_type")){ # if mime_content_type exists use it.
               $m = mime_content_type($filename);
            }else if(function_exists("")){    # if Pecl installed use it
               $finfo = finfo_open(FILEINFO_MIME);
               $m = finfo_file($finfo, $filename);
               finfo_close($finfo);
            }else{    # if nothing left try shell
               if(strstr($_SERVER[HTTP_USER_AGENT], "Windows")){ # Nothing to do on windows
                   return ""; # Blank mime display most files correctly especially images.
               }
               if(strstr($_SERVER[HTTP_USER_AGENT], "Macintosh")){ # Correct output on macs
                   $m = trim(exec('file -b --mime '.escapeshellarg($filename)));
               }else{    # Regular unix systems
                   $m = trim(exec('file -bi '.escapeshellarg($filename)));
               }
            }
            $m = split(";", $m);
            return trim($m[0]);
    }
}
?>

Vale con esto ya lo e resuelto, el problema esque no encontrava el sitio donde ponerlo pero ya esta.
Por cierto, sin esta modificacion no vale.
Draude escribió:De momento ya esta arreglado, he utilizado el codigo que me has pasado, modificando esto:

Código: Seleccionar todo

               if(strstr($_SERVER[HTTP_USER_AGENT], "Windows")){ # Nothing to do on windows
                   return ""; # Blank mime display most files correctly especially images.
               }
               if(strstr($_SERVER[HTTP_USER_AGENT], "Macintosh")){ # Correct output on macs
Por esto:

Código: Seleccionar todo

               if(strstr($_SERVER["HTTP_USER_AGENT"], "Windows")){ # Nothing to do on windows
                   return ""; # Blank mime display most files correctly especially images.
               }
               if(strstr($_SERVER["HTTP_USER_AGENT"], "Macintosh")){ # Correct output on macs
Sin comillas no funciona.

Y esta:

Código: Seleccionar todo

		$vartype = mime_content_type($vartemp);
Por esta:

Código: Seleccionar todo

		$vartype = get_mime($varname);
Tuve problemas al principio porque no me subia las imagenes en formato JPEG pero no se ni que e hecho ni porque pero ya funciona...

Muchas gracias a todos.

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 16 Abr 2010, 15:48
por teto86
Por cierto, se me olvidaba, por si acaso alguien mas tiene el mismo problema dejo una copia de mi imagehosting.php para que os sirva de ayuda.

Código: Seleccionar todo

<?php 
$varrand = substr(md5(uniqid(rand())),0,10);		
$varallw = array("image/bmp","image/gif","image/jpeg","image/jpg","image/pjpeg","image/png","image/x-png");
$varpath = "http://clubrenaultgt.com/foro/galeria/tmp/";
$varstat = "";

if ($_POST["action"] == "upload") {
	if (is_uploaded_file($_FILES["imagen"]["tmp_name"])) {
		$varname = $_FILES["imagen"]['name'];
		$vartemp = $_FILES['imagen']['tmp_name'];
		$vartype = get_mime($varname);

		if (in_array($vartype, $varallw) && $varname != "") {
			$arrname = explode(".", $varname);
			$varname = $varrand.".".$arrname[1];
			if (copy($vartemp, "tmp/".$varname)) {
				$varpath = $varpath.$varname;
				$varstat = "ok";
			} else {
				$varstat = "Error al subir el archivo";
			}
		} else {
			$varstat = "Archivo no valido";
		}
	}
}
?>

<?
/**
* Tries to get mime data of the file.
* @return {String} mime-type of the given file
* @param $filename String
*/
function get_mime($filename){
    preg_match("/\.(.*?)$/", $filename, $m);    # Get File extension for a better match
    switch(strtolower($m[1])){
        case "js": return "application/javascript";
        case "json": return "application/json";
	case "jpg": case "jpeg": case "jpe": return "image/jpg";
        case "png": case "gif": case "bmp": case "jpg": return "image/".strtolower($m[1]);
        case "css": return "text/css";
        case "xml": return "application/xml";
        case "html": case "htm": case "php": return "text/html";
        default:
            if(function_exists("mime_content_type")){ # if mime_content_type exists use it.
               $m = mime_content_type($filename);
            }else if(function_exists("")){    # if Pecl installed use it
               $finfo = finfo_open(FILEINFO_MIME);
               $m = finfo_file($finfo, $filename);
               finfo_close($finfo);
            }else{    # if nothing left try shell
                if(strstr($_SERVER["HTTP_USER_AGENT"], "Windows")){ # Nothing to do on windows
                   return ""; # Blank mime display most files correctly especially images.
               }
               if(strstr($_SERVER["HTTP_USER_AGENT"], "Macintosh")){ # Correct output on macs
                   $m = trim(exec('file -b --mime '.escapeshellarg($filename)));
               }else{    # Regular unix systems
                   $m = trim(exec('file -bi '.escapeshellarg($filename)));
               }
            }
            $m = split(";", $m);
            return trim($m[0]);
    }
}
?>

<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>Subir imagen al ClubRenaultGT</title>
<link href="cssupload.css" rel="stylesheet" type="text/css" />
</head>
<body>
<table width="420" border="0" align="center" cellpadding="0" cellspacing="0">
  <tr>
    <td width="413" height="40" class="titulo">ClubRenaultGT<img src="http://clubrenaultgt.com/foro/galeria/tmp/81f4addf36.jpg"></td>
  </tr>
  <tr>
    <td class="text">Aloja tu imagen con formatos gif, bmp, jpeg, png, en nuestro servidor de ClubRenaultGT:</td>
  </tr>
  <tr>
  <form action="imagehosting.php" method="post" enctype="multipart/form-data">
    <td height="50" valign="top" class="text">
      <input name="imagen" type="file" class="casilla" id="imagen" size="35" />
      <input name="enviar" type="submit" class="boton" id="enviar" value="Subir Imagen" />
	  <input name="action" type="hidden" value="upload" />	  </td>
	</form>
  </tr>
  <?php if ($varstat == "ok") { ?>
  <tr>
    <td class="textinf"><strong>Confirmaci&oacute;n:</strong><br>
	Archivo publicado satisfactoriamente. Puedes utilizar las siguientes opciones para enlazarlo:<br>
	<br>
	<strong>Enlace BBCode para poner la imagen en el foro:</strong> <br>
	<input name='txt1' type='text' value='[img]<?php echo $varpath; ?>[/img]' size='60'>
	<br>
	<strong>Enlace BBCode para crear diapositivas de todas las imagenes de tu post:</strong> <br>
	<input name='txt1' type='text' value='[slideshow=grupo1]<?php echo $varpath; ?>,Sin titulo[/slideshow]' size='60'>
	<br>
	<strong>Enlace Directo: </strong><br>
	<input name='txt2' type='text' value='<?php echo $varpath; ?>' size='60'></td>
  </tr>
  <?php } else { ?>
	  <?php if ($varstat != "") { ?>
	  <tr>
		<td class="textinf"><strong>Error:</strong><br>
	    <?php echo $varstat; ?>&nbsp;</td>
	  </tr>
	  <?php } ?>
  <?php } ?>
</table>
<?php if ($varstat == "ok") { ?>
<p align="center"><img src="tmp/<?php echo $varname; ?>"></p>
<?php } ?>
<?php if ($_GET['image'] != "") { ?>
<p align="center"><img src="tmp/<?php echo $_GET['image']; ?>"></p>
<?php } ?>
</body>
</html>

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 19 Abr 2010, 20:48
por ahh72
veo que solo era cosa de leer e indagar un poco en el tema 8)

enhorabuena por solucionarlo :ok:

saludos

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 20 Abr 2010, 07:49
por Draude
Hola teto, veo que se te ha solucionado. Muy bien.

Lo que comentas que no sabes porque te sube las imagenes jpg es por esta linea de tu imagehosting.php

Código: Seleccionar todo

$varallw = array("image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/x-png");
Saludos.

URL: http://massissosdelgarraf.com
Versión phpBB: phpBB3 (3.0.7 PL1)
MODs Instalados: Ninguno
Plantilla(s) usada(s): prosilver
Servidor: Windows
Actualización desde otra versión:
Conversión desde otro sistema de foros:

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 15 Ago 2010, 22:06
por ide
a ver sime echais una manita, tengo subido el foro en un subdominio y quiero meter la galeria en otro subdominio y por mas que lo intento no soy capaz alguna idea?

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 17 Ago 2010, 20:35
por ide
a ver que pongo como lo tengo puesto a ver que tal:
archivo modificado el posting editor.html que es donde me viene en el theme los botones.

Código: Seleccionar todo

<!-- IF not S_SHOW_DRAFTS and not $SIG_EDIT eq 1 -->
	<div class="panel bg3" id="options-panel">
		<div class="inner"><span class="corners-top"><span></span></span>

		<fieldset class="fields1">
			 <div><label for="Subir imagen"><iframe src="http://imagenes.cowboysdelared.net/iframe.php" scrolling="no" allowtransparency="true" frameborder="0" width="140" height="35"></iframe></label></div>
en esa direccion tengo subido el ipframe siguiente

Código: Seleccionar todo

<head>

<script language="javascript">
//Su explorador no soporta java o lo tiene deshabilitado; esta pagina necesita javascript para funcionar correctamente<!--
            
function abrir(direccion, pantallacompleta, herramientas, direcciones, estado, barramenu, barrascroll, cambiatamano, ancho, alto, izquierda, arriba, sustituir){
    var opciones = "fullscreen=" + pantallacompleta +
                 ",toolbar=" + herramientas +
                 ",location=" + direcciones +
                 ",status=" + estado +
                 ",menubar=" + barramenu +
                 ",scrollbars=" + barrascroll +
                 ",resizable=" + cambiatamano +
                 ",width=" + ancho +
                 ",height=" + alto +
                 ",left=" + izquierda +
                 ",top=" + arriba;
    var ventana = window.open(direccion,"venta",opciones,sustituir);

}                    
//-->    
</script> 

<input type="button" onclick="abrir('http://imagenes.cowboysdelared.net/galeria/imagehosting.php',0,0,0,0,0,0,0,600,455,60,20,1);" value="Subir imagen">

</head>
y este el el imagehosting.php

Código: Seleccionar todo

$varrand = substr(md5(uniqid(rand())),0,10);		
$varallw = array("image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/x-png");
$varpath = "http://imagenes.cowboysdelared.net/galeria/tmp/";
$varstat = "";
Todo esta subido al subdominio imagenes, pero el foro esta en el subdominio foro sepuede hacer o tiene que estar todo en el mismo subdominio?

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 15 Dic 2010, 21:37
por Turbooo
Lo he instalado y va de lujo!!!

muchas gracias al creador

por cierto sabeis si el bbcode [slideshow=grupo1]Link de la imagen,Sin titulo[/slideshow] existe???

lo he buscado por todas partes y no lo encuentro

si no existe tendria que modificar el archivo y meterle otro de imagenes

saludos

Re: Montar un servidor de imagenes en tu foro phpBB3

Publicado: 25 Ene 2012, 13:27
por teto86
Retomo este tema porque veo que la gente sube a mi servidor unas fotos con un tamaño desmesurado, entoces me proponia el poner un limte de 1MB a las fotos que se suben a mi servidor.

Para ello he seguido estos pasos que ponia "ator_18" en la primera pagina:

Código: Seleccionar todo

$varrand = substr(md5(uniqid(rand())),0,10);		

$varallw = array("image/bmp","image/gif","image/jpeg","image/pjpeg","image/png","image/x-png");

$varpath = "http://foromus.com/imagehosting.php?image=";

$varstat = "";
$tam = 1073741824; //Tamaño del archivo en este en este ejemplo 1MB

if ($_POST["action"] == "upload") {
	if (is_uploaded_file($_FILES["imagen"]["tmp_name"])) {
		$varname = $_FILES["imagen"]['name'];
		$vartemp = $_FILES['imagen']['tmp_name'];
		$vartype = mime_content_type($vartemp);

		if (in_array($vartype, $varallw) && $varname != "") {
			$arrname = explode(".", $varname);
			$varname = $varrand.".".$arrname[1];
			if ((filesize($vartemp) < $tam)) {
				if (copy($vartemp, "tmp/".$varname)) {
					$varpath = $varpath.$varname;
					$varstat = "ok";
				} else {
					$varstat = "Error al subir el archivo";
				}
			} else {
				$varstat = "El archivo excede el maximo de 1MB permitido";
		} else {
			$varstat = "Archivo no valido";
		}
	}
}
Pero me sale el siguiente error.

Parse error: syntax error, unexpected T_ELSE in /home/clubrena/public_html/foro/galeria/imagehosting.php on line 29

¿alguien sabe como solucionarlo? gracias.