Foros del Web

Foros del Web (http://www.forosdelweb.com/)
-   Sistemas de gestión de contenidos (http://www.forosdelweb.com/f54/)
-   -   Avatares en phpBB - Remotos (http://www.forosdelweb.com/f54/avatares-phpbb-remotos-339688/)

David_dfd 06/10/2005 12:56

Avatares en phpBB - Remotos
 
Un saludo amigos,

Tengo un problema con los avatares remotos de un phpBB. La cuestión es que algunos usuarios hacen su avatar extremadamente grande.

En la configuración lo tengo limitado a 150x200 pix. pero por lo visto esto solo funciona para los avatares que son enviados al foro:

- Enviar Avatar desde su PC:
- Enviar Avatar desde un URL:
Escriba el URL donde se encuentra el archivo de imagen de su Avatar, será copiado a este sitio.

A estos avatares si se les aplica la regla que le demos en la configuración, es decir, un máximo de 150x200 pix.

Si usamos los avatares remotos esta regla no se usa ya que el avatar es cogido desde otra web.

Alguien sabe como se puede limitar el tamaño de los avatares remotos a 150x200 pix.???

Yo he intentado modificar el codigo del foro para donde muestra la imagen colocar lo siguiente:

<img src="AVATAR" width="150" height="200">

Lo malo es que los que son menores lo hacen a ese tamaño, como es logico.

Gracias como siempre por la ayuda. ;)

Linterns 06/10/2005 14:00

Citado textualmente por un Code creado por Yoseman en tomaToma

Cita:

Para poder limitar el tamaño de los avatares que te suben al servidor , se puede intentar hacer un cambio en el archivo viewtopic.php view_topic.php.

El código original de viewtopic.php de phpBb2.06 es este

Línea 844

Código:

case USER_AVATAR_REMOTE:
$poster_avatar = ( $board_config'allow_avatar_remote'] ) ? '<img
src="' . $postrow[$i]['user_avatar'] . '" alt="" border="0" />' :
'';

Y si se sustituye por este el avatar debería de redimensionarse.

Con este pequeño código la imagen será redimensionada a escala si uno o ambos ejes superan los 80 pixeles:

Código:

        case USER_AVATAR_REMOTE:
                                $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" OnLoad="{if(this.width > 80 || this.height > 80) if((this.width / this.height) > 1) {this.width=80} else {this.height=80}};{if(this.width > 80 || this.height > 80) if((this.height / this.width) > 1) {this.height=80} else {this.width=80}}" border="0"  />' : '';
                                break;

Pruebalo a ver si te gusta. ;-)
Se puede mejorar un pelín (poner X=máximo ancho; Y=máxima altura)

Código:

        case USER_AVATAR_REMOTE:
                                $poster_avatar = ( $board_config['allow_avatar_remote'] ) ? '<img src="' . $postrow[$i]['user_avatar'] . '" alt="" OnLoad="X=ancho_máximo;Y=alto_máximo;if ( this.width > X && this.height < Y ){this.height = ( X * this.height ) / this.width;this.width= X};if (this.width < X && this.height > Y ){this.width = ( Y * (this.width) ) / this.height;this.height= Y};if ( this.width > X && this.height > Y ){if (this.width/this.height>=1){{this.height = ( X * this.height ) / this.width;this.width= X}}else {this.width = ( Y * (this.width) ) / this.height;this.height= Y}}" border="0"  />' : '';
                                break;

Este segundo tambíen se puede aplicar a la reducción de imagenés en el foro modificando la linea del /templates/plantilla/bbcode.tpl :

Código:

<!-- BEGIN img --><img src="{URL}" border="0" /><!-- END img -->
por esta otra (cambiando X e Y por los tamaños maximos de ancho y alto:

Código:

<!-- BEGIN img --><img src="{URL}" border="0" OnLoad="X=anchomax;Y=altomax;if ( this.width > X && this.height < Y ){this.height = ( X * this.height ) / this.width;this.width= X};if (this.width < X && this.height > Y ){this.width = ( Y * (this.width) ) / this.height;this.height= Y};if ( this.width > X && this.height > Y ){if (this.width/this.height>=1){{this.height = ( X * this.height ) / this.width;this.width= X}}else {this.width = ( Y * (this.width) ) / this.height;this.height= Y}}" /><!-- END img -->
Debería de funcionar.

Lo que ya no se, es hasta que punto este código puede ralentizar la carga de un tópico con muchas imágenes :?:

El segundo código es un poco mas elaborado y redimensiona a escala la imagen tomando como referencia el eje mayor (sea el ancho o el alto) y reduciéndolo a su parámetro mínimo, y asi poder redimensionar el otro eje. No se si se puede mejorar un poquillo, si alguien se atreve, yo no se hacerlo mejor.

Salu2 :saludos

David_dfd 06/10/2005 15:23

Muchisimas gracias Linterns

Voy a probarlo :arriba:

David_dfd 06/10/2005 15:51

Gracias me funciono perfectamente :arriba:

Linterns 06/10/2005 16:28

:arriba: :arriba:

[DARK_RULO] 08/10/2005 21:22

Gracias amigo Linterns. Algo asi andaba buscando también.^^

Saludos.

rozlilta 04/05/2006 08:59

De todos los códigos y mods que he intentado poner, lo único que realmente me funciona es esto. Muchisimas gracias. Un codigo sencillo y eficaz.

Por otro lado, el último trozo para redimensionar las imagenes en los post, también afecta a las imagenes de las firmas? Que mania tiene la gente con poner imagenes enormes en todos sitios ... xDD


La zona horaria es GMT -6. Ahora son las 02:53.

Desarrollado por vBulletin® Versión 3.8.7
Derechos de Autor ©2000 - 2026, Jelsoft Enterprises Ltd.