Page 1 of 1

align Images in posts

PostPosted: Wed Apr 02, 2008 6:26 am
Author: chopper
When trying to use an image from the album in a post, The popup window asks for what alignment you want. If you try to use any of them the image does not display. Only the code. does not matter if you try full album image or thumbnail.
this is the code that displays:

[albumimgl]1[/albumimgl]

I have changed the language file to tell members not to use this function for "security reasons" but it is still possible to attempt it. Is this a setting problem, host problem or IM141 problem.

Re: align Images in posts

PostPosted: Wed Apr 02, 2008 2:38 pm
Author: Helter
I think this is a advanced bbcode box problem. We had a dev working on it quite awhile ago, but he has not been seen in several months

Re: align Images in posts

PostPosted: Wed Apr 02, 2008 9:00 pm
Author: chopper
OK thanks. I have edited a fix that works. I'm sure the .script can be cleaned up but this does work.
In IM141/mods/bbcode_box/bbcode_box.js
find this code
Code: Select all
var Prompt2 = showPrompt("Enter image position.nLEFT = Position to left of text.nRIGHT = Position to right of text.nCENTER = Center in line.nLeave blank for no positioning.","",0,"",/(left|right|center)/i,"Valid options are 'left', 'right', 'center', or leave blank.");                 if (Prompt2 == "^pcncl-1")                 {                     Result2 = 1;                 }                 else if (Prompt2 != "^perr-1")                 {                         if (Prompt2.toLowerCase() == 'left')                     {                         if (imgType == "img")                         {                             Prompt2 = "=left";                         }                         else                         {                             Prompt2 = "l";                         }                     }                     if (Prompt2.toLowerCase() == 'right')                     {                         if (imgType == "img")                         {                             Prompt2 = "=right";                         }                         else                         {                             Prompt2 = "r";                         }                     }                     if (Prompt2.toLowerCase() == 'center')                     {                         if (imgType == "img")                         {                             Prompt2 = "=center";                         }                         else                         {                             Prompt2 = "c";                         }                     }                         ToAdd = "["+imgType;                     if (Prompt2 != '')                     {                         ToAdd += ""+Prompt2.toLowerCase();                     }                     if (imgType == "img")                     {                         ToAdd += "]"+Prompt1+"[/"+imgType+"]";                     }                     else                     {                         ToAdd += "]"+Prompt1+"[/"+imgType+""+Prompt2+"]";                     }                 }                 Result2 = 1;


and replace with this

Code: Select all
var Prompt2 = showPrompt("Enter image position.nLEFT = Position to left of text.nRIGHT = Position to right of text.nCENTER = Center in line.nLeave blank for no positioning.","",0,"",/(left|right|center)/i,"Valid options are 'left', 'right', 'center', or leave blank.");                 if (Prompt2 == "^pcncl-1")                 {                     Result2 = 1;                 }                 else if (Prompt2 != "^perr-1")                 {                         if (Prompt2.toLowerCase() == 'left')                     {                         if (imgType == "img")                         {                             Prompt2 = "=left";                         }                         else                         {                             Prompt2 = "=left";                         }                     }                     if (Prompt2.toLowerCase() == 'right')                     {                         if (imgType == "img")                         {                             Prompt2 = "=right";                         }                         else                         {                             Prompt2 = "=right";                         }                     }                     if (Prompt2.toLowerCase() == 'center')                     {                         if (imgType == "img")                         {                             Prompt2 = "=center";                         }                         else                         {                             Prompt2 = "=center";                         }                     }                         ToAdd = "";                     if (Prompt2 != '')                     {                     if (imgType == "img")                      {                         ToAdd += "[img"+Prompt2.toLowerCase()+"]"+Prompt1+"[/"+imgType+"]";                      }                     else                      {                         ToAdd += "[align"+Prompt2.toLowerCase()+"]["+imgType+"]"+Prompt1+"[/"+imgType+"][/align]";                      }                                           }                     else                     {                     ToAdd += "["+imgType+"]"+Prompt1+"[/"+imgType+"]";                 }                 }                 Result2 = 1;

That .script needs to be rewritten because some of the variables do not work and I only changed them so they would. They arent even needed.

Edited on 04/29/2008 and the above code now works correctly.

Re: align Images in posts

PostPosted: Wed Apr 02, 2008 9:25 pm
Author: Helter
thx...Ive bookmarked this so I can look at it when im a little less sleep deprived...lol

PostPosted: Mon May 12, 2008 6:44 am
Author: sanji
This fix is, indeed, fixing the problem with the [albumimg] tag - which can now be centered. Unfortunately, the [img=center] is not working...

sanji

Re: align Images in posts

PostPosted: Mon May 12, 2008 2:18 pm
Author: chopper
I will check it out and see if i can find what's wrong because left and right alignment are working correctly

Re: align Images in posts

PostPosted: Tue May 13, 2008 1:41 pm
Author: chopper
Ok this code works for left right and center.
It's not very clean but it works.
Find this:
Code: Select all
 var Prompt2 = showPrompt("Enter image position.nLEFT = Position to left of text.nRIGHT = Position to right of text.nCENTER = Center in line.nLeave blank for no positioning.","",0,"",/(left|right|center)/i,"Valid options are 'left', 'right', 'center', or leave blank.");             if (Prompt2 == "^pcncl-1")             {                Result2 = 1;             }             else if (Prompt2 != "^perr-1")             {                   if (Prompt2.toLowerCase() == 'left')                {                   if (imgType == "img")                   {                      Prompt2 = "=left";                   }                   else                   {                      Prompt2 = "l";                   }                }                if (Prompt2.toLowerCase() == 'right')                {                   if (imgType == "img")                   {                      Prompt2 = "=right";                   }                   else                   {                      Prompt2 = "r";                   }                }                if (Prompt2.toLowerCase() == 'center')                {                   if (imgType == "img")                   {                      Prompt2 = "=center";                   }                   else                   {                      Prompt2 = "c";                   }                }                   ToAdd = "["+imgType;                if (Prompt2 != '')                {                   ToAdd += ""+Prompt2.toLowerCase();                }                if (imgType == "img")                {                   ToAdd += "]"+Prompt1+"[/"+imgType+"]";                }                else                {                   ToAdd += "]"+Prompt1+"[/"+imgType+""+Prompt2+"]";                }             }             Result2 = 1;  


and replace with this]  var Prompt2 = showPrompt("Enter image position.nLEFT = Position to left of text.nRIGHT = Position to right of text.nCENTER = Center in line.nLeave blank for no positioning.","",0,"",/(left|right|center)/i,"Valid options are 'left', 'right', 'center', or leave blank.");             if (Prompt2 == "^pcncl-1")             {                Result2 = 1;             }             else if (Prompt2 != "^perr-1")             {                   if (Prompt2.toLowerCase() == 'left')                {                   if (imgType == "img")                   {                      Prompt2 = "=left";                   }                   else                   {                      Prompt2 = "=left";                   }                }                if (Prompt2.toLowerCase() == 'right')                {                   if (imgType == "img")                   {                      Prompt2 = "=right";                   }                   else                   {                      Prompt2 = "=right";                   }                }                if (Prompt2.toLowerCase() == 'center')                {                   if (imgType == "img")                   {                      Prompt2 = "=center";                   }                   else                   {                      Prompt2 = "=center";                   }                }                   ToAdd = "";                if (Prompt2 != '')                {                if (imgType == "img")                 {                   ToAdd += "[align"+Prompt2.toLowerCase()+"]["+imgType+"]"+Prompt1+"[/"+imgType+"][/align]";                 }                else                 {                   ToAdd += "[align"+Prompt2.toLowerCase()+"]["+imgType+"]"+Prompt1+"[/"+imgType+"][/align]";                 }                                }                else                {                ToAdd += "["+imgType+"]"+Prompt1+"[/"+imgType+"]";             }             }             Result2 = 1;  [/code]

Re: align Images in posts

PostPosted: Wed May 14, 2008 1:08 am
Author: Allen
Nice job, Thank you. This worked to solve the center issue