Calificación:
  • 0 voto(s) - 0 Media
  • 1
  • 2
  • 3
  • 4
  • 5
redimensionar imagenes subidas por bbcodes
#1
redimensionar imagenes subidas por bbcodes como hace skylium

al subir imagenes mediante bbcodes si esta es muy grande se sale del post hacia los constados
me pregunto si se puede redimensionar para que la imagen se pueda mostrar correctamente.

no se si deberia hacerlo con php o si debo hacerlo agregando paramentros al mismo bbcode

codigo que utilizo al postear
postear.php
[spoiler]http://pastebin.com/8NYJrZHS[/spoiler]


bbcode.js
Código:
case "img":
var imageUrl = prompt("Enter image URL:", "http://");
if((imageUrl== null) || (textTrim(imageUrl)== "")){return;}
str='[img]'+textTrim(imageUrl)+'[/img]';
break;


bbcode.js [Completo]
[spoiler]
Código:
var fw_currentColor="#000000";
if(typeof bbCodeValue == "undefined"){var bbCodeValue='';}
if(typeof maxCodeLength == "undefined"){var maxCodeLength=10000;}
function addBBcodeEvents(){
var td = document.getElementsByTagName('TD');
for(var i in td){
if (td[i].className == "fw_tool"){
td[i].onmouseover = btnOver;
td[i].onmouseout = btnOut;
td[i].onmousedown = btnDown;
td[i].onmouseup = btnOver;
td[i].onclick = btnClick;}
else if(td[i].className=="fw_color"){
td[i].onmouseover=colorOver;
td[i].onmouseout=colorOut;
td[i].onclick=colorClick;}
}
var x=document.getElementById('forecolor');
x.onmouseover=forecolorOver;
x.onmouseup=forecolorOver;
x.onmouseout=forecolorOut;
x.onmousedown=forecolorDown;
x.onclick=btnClick;
x=document.getElementById('fw_changecolor');
document.getElementById('fw_colorbar').style.background=fw_currentColor;
x.onmouseover=forecolorOver;
x.onmouseout=forecolorOut;
x.onclick=function(){
document.getElementById("fw_colorpalette").style.left=getLeft(this)-180;
document.getElementById("fw_colorpalette").style.top=getTop(this)+this.offsetHeight;
document.getElementById("fw_colorpalette").style.display="block";}
}
function btnClick(){
var id=this.id;
if(id=='previewBBCode'){previewCode();return;}
var editor = document.getElementById(bbCodeEditorID);
if(document.selection){
editor.focus();
var sel = document.selection.createRange();
switch(id){
case "ol": case "ul":
sel.text='['+id+']'+formatList(sel.text)+'[/'+id+']';break;
case "b": case "i": case "u": case "s": case "code": case "quote": case "sup": case "sub":
sel.text='['+id+']'+sel.text+'[/'+id+']';
break;
case "forecolor":
sel.text='[color='+fw_currentColor+']'+sel.text+'[/color]';break;
case "img":
var imageUrl = prompt("Enter image URL:", "http://");
if((imageUrl== null) || (textTrim(imageUrl)== "")){return;}
sel.text='[img]'+textTrim(imageUrl)+'[/img]';
break;

case "link":
var url = prompt("Enter link URL:", "http://");
if((url== null) || (textTrim(url)== "")){return;}
sel.text=((sel.text)? '[url=' + textTrim(url) + ']' + sel.text + '[/url]' : '[url]'  + textTrim(url) + '[/url]');}}
else{mozilla(editor,id);}
}
function mozilla(editor,id){
var top = editor.scrollTop;
var left = editor.scrollLeft;
var length = editor.value.length;
var start = editor.selectionStart;
var end = editor.selectionEnd;
sel = editor.value.substring(start, end);
var str;
switch(id){
case "ol": case "ul":
sel=formatList(sel);
case "b": case "i": case "u": case "center": case "left": case "right": case "s": case "code": case "quote": case "sup": case "sub":
str = '['+id+']'+sel+'[/'+id+']';
break;
case "forecolor":
str='[color='+fw_currentColor+']'+sel+'[/color]';
break;
case "img":
var imageUrl = prompt("Enter image URL:", "http://");
if((imageUrl== null) || (textTrim(imageUrl)== "")){return;}
str='[img]'+textTrim(imageUrl)+'[/img]';
break;
case "link":
var url = prompt("Enter link URL:", "http://");
if((url== null) || (textTrim(url)== "")){return;}
str=((sel)? '[url=' + textTrim(url) + ']' + sel + '[/url]' : '[url]'  + textTrim(url) + '[/url]');}
editor.value =  editor.value.substring(0,start) + str + editor.value.substring(end,length);
editor.scrollTop = top;
editor.scrollLeft = left;
}
function formatList(s){var items=s.split('\n');var str='';for(var i=0;i<items.length;i++){str+= '[li]' + items[i]+'[/li]\n';}return(str);}
function forecolorOver(){document.getElementById("fw_forecolor").style.border="1px solid #0a246a";document.getElementById("fw_forecolor").style.background="#b6bdaa";document.getElementById('fw_changecolor').style.borderColor="#0a246a";}
function forecolorOut(){document.getElementById("fw_forecolor").style.border="1px solid #ffffff";document.getElementById("fw_forecolor").style.background="none";document.getElementById('fw_changecolor').style.borderColor="#ffffff";}
function forecolorDown(){document.getElementById("fw_forecolor").style.border="1px solid #0a246a";document.getElementById("fw_forecolor").style.background="#aad5ff";document.getElementById('fw_changecolor').style.borderColor="#0a246a";}
function colorOver(){this.style.border="1px outset";}
function colorOut(){this.style.border="1px inset";}
function colorClick(){document.getElementById('fw_colorSample').style.background=this.id;document.getElementById('fw_hexValue').value=this.id;}
function colorText(){document.getElementById('fw_colorSample').style.background=document.getElementById('fw_hexValue').value;}
function btnOver(){this.style.border="1px solid #0a246a";this.style.background="#b6bdaa";}
function btnOut(){this.style.background="none";this.style.border="1px solid #ffffff";}
function btnDown(){this.style.background="#aad5ff";}
function resetColor(){document.getElementById("fw_colorpalette").style.display="none";document.getElementById('fw_hexValue').value="";document.getElementById('fw_colorSample').style.background="none";document.getElementById("fw_colorpalette").style.display="none";}
function colorOk(){var x=document.getElementById('fw_hexValue').value;if(x!=""){fw_currentColor=document.getElementById('fw_hexValue').value;}resetColor();document.getElementById('fw_colorbar').style.background=fw_currentColor;}
function getLeft(obj){var leftValue= 0;while(obj){leftValue+= obj.offsetLeft;obj= obj.offsetParent;}return leftValue;}
function getTop(obj){var topValue= 0;while(obj){topValue+= obj.offsetTop;obj= obj.offsetParent;}return topValue;}
function getUrl(){
var thisscript = document.getElementsByTagName('script');
for (var i=0; i<thisscript.length; i++) {if(thisscript[i].src.indexOf('bbcode.js')>=0){return(thisscript[i].src.replace('script/bbcode.js',''));}}return '';}
function textTrim(str){return str.replace(/^\s\s*/, '').replace(/\s\s*$/, '');}
function previewCode(){
var str=textTrim(document.getElementById(bbCodeEditorID).value).length;
if((str > maxCodeLength)||(str <10)){alert("Please write comment between 10 to "+maxCodeLength+" characters!");return;}
var url=getUrl()+'preview.php?editor='+bbCodeEditorID;
window.open(url,'Preview','width=690,height=350 ,toolbar=no,location=no,directories=no,status=yes,menubar=no,scrollbars=yes,copyhistory=yes');
}
var head = document.getElementsByTagName("head")[0];        
var css = document.createElement('link');
var url=getUrl();
css.type = 'text/css';
css.rel = 'stylesheet';
css.href = url+'css/bbcode.css';
head.appendChild(css);
var str="<div id=\"fw_toolbox\">";
str+="<table>";
str+="<tr>";
str+="<td class=\"fw_tool\" id=\"previewBBCode\"><img src=\""+url+"images/buttons/preview.gif\" title=\"Vista previa\" alt=\"Preview\" /></td>";
str+="<td class=\"separator\"><img src=\""+url+"images/buttons/separator.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_tool\" id=\"ol\"><img src=\""+url+"images/buttons/ol.gif\" title=\"Lista ordenada\" alt=\"Ordered list\" /></td>";
str+="<td class=\"fw_tool\" id=\"ul\"><img src=\""+url+"images/buttons/ul.gif\" title=\"Lista\" alt=\"List\" /></td>";
str+="<td class=\"separator\"><img src=\""+url+"images/buttons/separator.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_tool\" id=\"left\"><img src=\""+url+"images/buttons/izquierda.gif\" title=\"Alinear texto a la izquierda\" alt=\"Center\" /></td>";
str+="<td class=\"fw_tool\" id=\"center\"><img src=\""+url+"images/buttons/Centro.gif\" title=\"Centrar texto\" alt=\"Center\" /></td>";
str+="<td class=\"fw_tool\" id=\"right\"><img src=\""+url+"images/buttons/derecha.gif\" title=\"Alinear texto a la derecha\" alt=\"Center\" /></td>";
str+="<td class=\"separator\"><img src=\""+url+"images/buttons/separator.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_tool\" id=\"b\"><img src=\""+url+"images/buttons/b.gif\" title=\"Negrita\" alt=\"Bold\" /></td>";
str+="<td class=\"fw_tool\" id=\"i\"><img src=\""+url+"images/buttons/i.gif\" title=\"Cursiva\" alt=\"Italic\" /></td>";
str+="<td class=\"fw_tool\" id=\"u\"><img src=\""+url+"images/buttons/u.gif\" title=\"Subrayado\" alt=\"Underline\" /></td>";
str+="<td class=\"fw_tool\" id=\"s\"><img src=\""+url+"images/buttons/strikethrough.gif\" title=\"Tachado\" alt=\"Strikethrough\" /></td>";
str+="<td class=\"separator\"><img src=\""+url+"images/buttons/separator.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_tool\" id=\"sup\"><img src=\""+url+"images/buttons/superscript.gif\" title=\"Superscript\" alt=\"Superscript\" /></td>";
str+="<td class=\"fw_tool\" id=\"sub\"><img src=\""+url+"images/buttons/subscript.gif\" title=\"Subscript\" alt=\"Subscript\" /></td>";
str+="<td class=\"separator\"><img src=\""+url+"images/buttons/separator.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_tool\" id=\"link\"><img src=\""+url+"images/buttons/link.gif\" title=\"Link\" alt=\"Link\" /></td>";
str+="<td class=\"fw_tool\" id=\"img\"><img src=\""+url+"images/buttons/insertimage.gif\" title=\"Insertar imagen\" alt=\"Image\" /></td>";
str+="<td class=\"separator\"><img src=\""+url+"images/buttons/separator.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_tool\" id=\"code\"><img src=\""+url+"images/buttons/code.gif\" title=\"Insertar codigo\" alt=\"Code\" /></td>";
str+="<td class=\"fw_tool\" id=\"quote\"><img src=\""+url+"images/buttons/quote.gif\" title=\"citar comentario\" alt=\"Quote\" /></td>";
str+="<td class=\"separator\"><img src=\""+url+"images/buttons/separator.gif\" alt=\"\" /></td>";
str+="<td id=\"fw_forecolor\" style=\"text-align:left;width:28px;padding:0 2px;border:1px solid #ffffff;\">";
str+="<div id=\"forecolor\" style=\"float:left; clear:left;width:15px;\"><img style=\"\" src=\""+url+"images/buttons/forecolor.gif\" title=\"Color de texto\" alt=\"Text color\" />";
str+="<img id=\"fw_colorbar\" style=\"margin:1px 0 0 0;padding:0;\" src=\""+url+"images/buttons/colorbar.gif\" alt=\"\" /></div>";
str+="<div id=\"fw_changecolor\" style=\"float:right; clear:right;border-left:1px solid #ffffff;\"><img src=\""+url+"images/buttons/color.gif\" title=\"Cambiar color\" alt=\"Change color\" /></div>";
str+="</td>";
str+="<td class=\"separator\"><img src=\""+url+"images/buttons/separator.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_tool\" id=\"video\"><img src=\""+url+"images/buttons/youtube.gif\" title=\"insertar video\" alt=\"Video\" /></td>";
str+="<td>&nbsp;</td>";
str+="</tr></table></div>";
str+="<div id=\"fw_colorpalette\">";
str+="<table id=\"fw_color\" cellpadding=\"1\" cellspacing=\"3\">";
str+="<tbody><tr>";
str+="<td class=\"fw_color\" id=\"#FFFFFF\" bgcolor=\"#ffffff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FFCCCC\" bgcolor=\"#ffcccc\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FFCC99\" bgcolor=\"#ffcc99\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FFFF99\" bgcolor=\"#ffff99\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FFFFCC\" bgcolor=\"#ffffcc\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#99FF99\" bgcolor=\"#99ff99\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#99FFFF\" bgcolor=\"#99ffff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#CCFFFF\" bgcolor=\"#ccffff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#CCCCFF\" bgcolor=\"#ccccff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FFCCFF\" bgcolor=\"#ffccff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="</tr>";
str+="<tr>";
str+="<td class=\"fw_color\" id=\"#CCCCCC\" bgcolor=\"#cccccc\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FF6666\" bgcolor=\"#ff6666\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FF9966\" bgcolor=\"#ff9966\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FFFF66\" bgcolor=\"#ffff66\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FFFF33\" bgcolor=\"#ffff33\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#66FF99\" bgcolor=\"#66ff99\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#33FFFF\" bgcolor=\"#33ffff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#66FFFF\" bgcolor=\"#66ffff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#9999FF\" bgcolor=\"#9999ff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FF99FF\" bgcolor=\"#ff99ff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="</tr>";
str+="<tr>";
str+="<td class=\"fw_color\" id=\"#C0C0C0\" bgcolor=\"#c0c0c0\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FF0000\" bgcolor=\"#ff0000\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FF9900\" bgcolor=\"#ff9900\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FFCC66\" bgcolor=\"#ffcc66\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FFFF00\" bgcolor=\"#ffff00\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#33FF33\" bgcolor=\"#33ff33\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#66CCCC\" bgcolor=\"#66cccc\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#33CCFF\" bgcolor=\"#33ccff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#6666CC\" bgcolor=\"#6666cc\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#CC66CC\" bgcolor=\"#cc66cc\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="</tr>";
str+="<tr>";
str+="<td class=\"fw_color\" id=\"#999999\" bgcolor=\"#999999\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#CC0000\" bgcolor=\"#cc0000\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FF6600\" bgcolor=\"#ff6600\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FFCC33\" bgcolor=\"#ffcc33\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#FFCC00\" bgcolor=\"#ffcc00\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#33CC00\" bgcolor=\"#33cc00\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#00CCCC\" bgcolor=\"#00cccc\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#3366FF\" bgcolor=\"#3366ff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#6633FF\" bgcolor=\"#6633ff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#CC33CC\" bgcolor=\"#cc33cc\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="</tr>";
str+="<tr>";
str+="<td class=\"fw_color\" id=\"#666666\" bgcolor=\"#666666\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#990000\" bgcolor=\"#990000\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#CC6600\" bgcolor=\"#cc6600\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#CC9933\" bgcolor=\"#cc9933\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#999900\" bgcolor=\"#999900\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#009900\" bgcolor=\"#009900\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#339999\" bgcolor=\"#339999\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#3333FF\" bgcolor=\"#3333ff\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#6600CC\" bgcolor=\"#6600cc\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#993399\" bgcolor=\"#993399\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="</tr>";
str+="<tr>";
str+="<td class=\"fw_color\" id=\"#333333\" bgcolor=\"#333333\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#660000\" bgcolor=\"#660000\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#993300\" bgcolor=\"#993300\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#996633\" bgcolor=\"#996633\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#666600\" bgcolor=\"#666600\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#006600\" bgcolor=\"#006600\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#336666\" bgcolor=\"#336666\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#000099\" bgcolor=\"#000099\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#333399\" bgcolor=\"#333399\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#663366\" bgcolor=\"#663366\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="</tr>";
str+="<tr>";
str+="<td class=\"fw_color\" id=\"#000000\" bgcolor=\"#000000\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#330000\" bgcolor=\"#330000\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#663300\" bgcolor=\"#663300\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#663333\" bgcolor=\"#663333\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#333300\" bgcolor=\"#333300\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#003300\" bgcolor=\"#003300\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#003333\" bgcolor=\"#003333\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#000066\" bgcolor=\"#000066\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#330099\" bgcolor=\"#330099\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="<td class=\"fw_color\" id=\"#330033\" bgcolor=\"#330033\"><img src=\""+url+"images/buttons/colorcell.gif\" alt=\"\" /></td>";
str+="</tbody></table>";
str+="<table><tr><td id=\"fw_colorSample\" style=\"width:20px;height:13px;\"></td><td style=\"border:none;padding-left:5px;\">Hex value:</td><td style=\"border:none;\"><input type=\"text\" id=\"fw_hexValue\" style=\"width:80px;font-size:10px;border:1px solid #999999;\" onchange=\"colorText()\" onkeypress=\"colorText()\" /></td></tr>";
str+="<tr><td colspan=\"3\" style=\"text-align:center; padding:5px;\"><input type=\"button\" value=\"Ok\" onclick=\"colorOk()\" /> <input type=\"button\" value=\"Cancel\" onclick=\"resetColor()\" /></td></tr>";
str+="</table>";
str+="</div>";
document.write(str);
addBBcodeEvents();
[/spoiler]


functions.php
http://pastebin.com/pd1D78Qw
#2
Podrías hacerlo con CSS, no habría que mover nada en la funciones. Por ejemplo:

Código:
.ejemplo{
    overflow:hidden;
}
.ejemplo img{
    width:100%;
    height:auto;
    max-width:700px;
}

Donde .ejemplo es la clase del cuerpo del contenedor.

overflow:hidden; oculta todo lo que se salga del contenedor; width:100% muestra la imágen a todo el ancho del contenedor y con max-width:700px; estableces el ancho máximo que puede tomar dicha imágen.

Hubiese sido de mucha ayuda que publicaras tu web o almenos mencionaras el CMS que usas, entonces se te podría ayudar mejor.
WWW
#3
nosotros usams un plugin, pero tambien lo puedes hacer mediantre un mycode que puedes encontrar aqui http://www.mybb-es.com/hilo-mycode-dimen...genes-caja
WWW
#4
En realidad @papi@ ahora mismo se está usando una clase de CSS para redimensionar las imágenes de los post y de las firmas.

Con CSS es más sencillo, siempre es mejor prescindir de plugins que pudieran sobrecargar el foro
WWW
#5
gracias por sus respouestas ya lo he resuelto Gran sonrisa
#6
Siempre tuve este problemota pues no sabía como y nunca me puse a pensar en CSS jeje, conocía de la propiedad max-width pero no se me ocurrió aplicarlo en imágenes Lengua

Gracias por la información, podría usar esto en muchos lugares Guiño
WWW


Posibles temas similares...
Tema Autor Respuestas Vistas Último mensaje
  jQuery: ocultar imágenes rotas Jvh_22 10 913 03-01-2017, 09:26 PM
Último mensaje: gassip
  Como subir Archivos, Imagenes PHP MysQL gassip 0 1,691 24-10-2016, 06:59 AM
Último mensaje: gassip
  Cargar web (con imagenes) mas rapido CarlosAlberto 18 1,687 08-03-2016, 01:34 AM
Último mensaje: LaaprendizdeCM
  Subir imagenes con PHP y class.upload.php cmascreativo 0 437 18-02-2016, 05:54 PM
Último mensaje: cmascreativo
  Codigo Imágenes que cambian automáticamente tucine 8 963 19-05-2015, 03:36 PM
Último mensaje: betiko2424
Bombilla [PUBLICO] Imágenes con descripción animada CSS3 AngelKrak 1 652 20-01-2015, 06:29 AM
Último mensaje: garcon
  script bueno para secuencia imagenes canpios 7 986 19-12-2014, 06:01 AM
Último mensaje: amplox
  Problema con imagenes othgeg 14 1,175 01-09-2014, 12:43 AM
Último mensaje: romeho
  No puedo renombrar imágenes con PHP Samo30 6 1,727 16-08-2014, 06:34 AM
Último mensaje: AbaddonOrmuz
  Centrar imagenes con css rubenpl 2 541 18-01-2014, 06:56 PM
Último mensaje: JsAlexM



Usuarios navegando en este tema: 1 invitado(s)