Author |
Topic |
|
ewyglend
New Member
83 Posts |
Posted - 01 November 2002 : 09:12:49
|
I am attempting to include alt tags and possibly long desc tags into the image insertion option. I went to inc_code.asp and tried to change the javascript, this is what I changed it to:
function image() {
if (helpstat){
alert("Image Tag Inserts an image into the post.\n\nUSE: ");
} else if (basic) {
AddTxt="";
AddText(AddTxt);
} else {
txt2=prompt("URL for graphic","http://");
if (txt2!=null) {
txt=prompt("Alt Tag for the Image","");
if (txt!=null) {
if (txt2=="") {
AddTxt="[img alt=\""+txt+"\"]"+txt2+"";
AddText(AddTxt);
}
}
}
}
} |
Edited by - ewyglend on 01 November 2002 15:03:27 |
|
ewyglend
New Member
83 Posts |
Posted - 01 November 2002 : 09:15:26
|
Hmm strange, my entire post is not showing up. Here is the rest of it:
I then realized that I needed to go into inc_functions and create some sort of forum code to allow [img alt=] to actually function right. But I am at a loss as what to do in inc_functions. I found this spot:
if strIMGInPosts = "1" then
fString = replace(fString, "<img src=""","", 1, -1, 1)
fString = replace(fString, """ id=right border=0>","[/img=right]", 1, -1, 1)
fString = replace(fString, """ id=left border=0>","[/img=left]", 1, -1, 1)
end if
and I thought maybe it is something in here, but everything I try doesn't work. Any suggestions? |
|
|
Roland
Advanced Member
Netherlands
9335 Posts |
Posted - 01 November 2002 : 14:32:52
|
just a small guess (since I've never taken the time to look at inc_code.asp), but I think the reason it doesn't work is because you're using ASP in a JavaScript function... |
|
|
ewyglend
New Member
83 Posts |
Posted - 01 November 2002 : 15:04:50
|
For some reason the boards messed up the code I entered in ( I even used the "code" tags). Anyways, here is the javascript without the ASP mysteriously being jumbled into it. The red code is the stuff I actually changed, hopefully this will make more sense.
function image() {
if (helpstat){
alert("Image Tag Inserts an image into the post.\n\nUSE: [ img ]http://www.anywhere.com/image.gif[/img]");
} else if (basic) {
AddTxt="[ img ]"+text+"[ /img ]";
AddText(AddTxt);
} else {
txt2=prompt("URL for graphic","http://");
if (txt2!=null) {
txt=prompt("Alt Tag for the Image","");
if (txt!=null) {
if (txt2=="") {
AddTxt="[ img alt=\""+txt+"\" ]"+txt2+"[ /img ]";
AddText(AddTxt);
}
}
}
}
}
|
Edited by - ewyglend on 06 November 2002 11:44:30 |
|
|
ewyglend
New Member
83 Posts |
Posted - 05 November 2002 : 00:54:47
|
besides the fact that this post is incredibly confusing, does anyone know how I might be able to complete this? |
|
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 05 November 2002 : 04:12:11
|
hi~ ewyglend,
i think the [ code ] tags should be ok, if the code you want to show us including forum code, you can insert a space [ img] or use another symbol {img}... to prevent it mess up you source code. |
|
|
ewyglend
New Member
83 Posts |
Posted - 06 November 2002 : 11:46:38
|
Thanks, that did help me sort out the forum code issue, so at least my code is displaying correctly. I have been playing around with the code more myself but I still can't get an image inserted through forum code to have an alt tag. |
|
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 06 November 2002 : 13:04:46
|
hi~ ewyglend, it's great idea for img tag! but i think not so easy to do this... if you take a look to Function ReplaceImageTags in inc_func_common.asp you'll know the [ img ] tag is a little bit different with other forum code.
i'm not sure is it something security problem if we just do this as a general forum code replace function...
but... for a worthy trying, why not ? i think you can refer to the "Flash Code" addon... (try search...) it's almost the same doing for adding a new forum code by yourself.
i also add some special forum code for my personal usage before. by my experience: try make your custom forum code as special as possible! (at least, add a special id value for it...) otherwise it'll mess up with the other code when edit/quote....
for example: in chkString function (inc_func_common) fString = doCode(fString, "[altimg=#","#]","<img alt=""",""" border=""0"" src=""") fString = replace(fString,"[/altimg]",""" id=""altimg"">", 1, -1, 1)
and in CleanCode function (inc_func_posting) fString = replace(fString, "<img alt=""","[altimg=#", 1, -1, 1) fString = replace(fString, """ border=""0"" src=""","#]", 1, -1, 1) fString = replace(fString, """ id=""altimg"">","[/altimg]", 1, -1, 1)
and the inc_code.js just as what you doing, it's fine.
in basically, i think this can transfer... [altimg=#xxxxx#]http..imglink[/altimg] to <img alt="xxxxx" border="0" src="http...imglink" id="altimg">
not sure it'll work no problem... but worth trying it.
<-- just test it, it seem work ! ----> |
Edited by - DoraMoon on 06 November 2002 13:12:14 |
|
|
ewyglend
New Member
83 Posts |
Posted - 08 November 2002 : 14:04:00
|
I think I am catching on to what you are saying, although i don't have the files inc_func_common or inc_func_posting, I only have inc_functions, so I don't know where to look for all of this. |
|
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 08 November 2002 : 15:38:42
|
sorry, have'nt noticed this.. in your case it should be inc_functions.asp
but i think it's the same doing, no matter v3.4 or v3.3 here is another example.. in inc_functions.asp find this function CleanCode(fString) then in this function below this line add 4 lines if strIMGInPosts = "1" then '##### Img Alt tag addon - 3 lines added fString = replace(fString, "<img alt=""","[img alt=""", 1, -1, 1) fString = replace(fString, """ border=""0"" src=""","""]", 1, -1, 1) fString = replace(fString, """ id=""altimg"">","[/img=alt]", 1, -1, 1)
then the same in inc_functions.asp, find function chkString(pString,fField_Type) then in this function below this line add 3 lines if strAllowForumCode = "1" and fField_Type <> "signature" then '##### Img Alt tag addon - 2 lines added fString = doCode(fString, "[img alt=""","""]","<img alt=""",""" border=""0"" src=""") fString = replace(fString,"[/img=alt]",""" id=""altimg"">", 1, -1, 1)
then go to make a new topic/post and try typing forum code in your post like this..
[img alt="This is Alternative Text for Img tag."]http://forum.snitz.com/forum/logo_snitz_forums_2000.gif[img=alt]
and see if can work.....
except the ReplaceImageTags issue i mentioned in previous post (it maybe related to security problem..), i also think about another problem for this stuff... if user input some "" or ">...etc, it maybe will mess up your web page. and i have no idea how to prevent this.... |
Edited by - DoraMoon on 08 November 2002 15:40:32 |
|
|
ewyglend
New Member
83 Posts |
Posted - 11 November 2002 : 12:36:31
|
thank you! That worked perfectly. Now all I have to do is figure out how to make prompt mode and help mode bring up the alt tag option too, but that should not be nearly as difficult. Thanks again.
|
|
|
ewyglend
New Member
83 Posts |
Posted - 04 December 2002 : 12:59:19
|
I have run into a problem somewhere along the way where when I type in
{img alt="this is the alt tag"}http://www.site.com/urlofimage.jpg{/img alt} the image wont display, and when I right click on it to see the url, it is looking for "http://www.site.com/urlofimage.jpg{/img alt]...." It is not cutting off the url at the end of .jpg like it should. Anyone have any ideas? |
|
|
DoraMoon
Average Member
Taiwan
661 Posts |
Posted - 06 December 2002 : 12:53:12
|
hi~ ewyglend, usually this problem just cause from the Forum Code <===> HTML Code did'nt match... as i mentioned above, all these just "string replace" work. though we really must very carefully when writing these custom forum code.
in above example, there are three parts in this set of forum code..
[img alt=" <===> <img alt="
"] <===> " border="0" src="
[/img=alt] <===> " id="altimg"> so suppose we typing [img alt="xxxxx"]yyyyy[/img=alt], then we'd like to "transfer" it to <img alt="xxxxx" border="0" src="yyyyy" id="altimg">
and as i remind that.. for these custom forum code.. as special as better!! it's for preventing conflict with the other forum codes.
anyway, try checking those corresponding code again... it should be not so hard to find out where the wrong code. |
|
|
ewyglend
New Member
83 Posts |
Posted - 06 December 2002 : 16:01:40
|
thanks so much! |
|
|
|
Topic |
|
|
|