Author |
Topic  |
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 28 November 2004 : 20:23:17
|
I have implemented a script with the help of ruirib that uploads an image and creates a thumbnail. My intentions are to insert the thumbnails into the thread and when clicked, the original image will display. I started to create forum tag called [thumb][/thumb] but it's not coming out the way I want. My primary goal is to have just one forum tag do the function similar to this:
[url="SomeImage.jpg"][img]SomeSmallImage.jpg[/img][/url]
|
|
Edited by - dayve on 30 November 2004 10:50:04 |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 28 November 2004 : 20:30:18
|
what code do you have so far?
is there a basis for image names? like the thumbnails are thumb_x.jpg vs the actual image being x.jpg? |
-Stim |
Edited by - Da_Stimulator on 28 November 2004 20:31:05 |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 28 November 2004 : 20:39:59
|
the code I have so far may not make sense and is probably unusable because I will not be able to approach it this way. I'm thinking of just calling the image like so:
[img]image?SomeSamllImage.jpg[/img]
and let the script handle the structure I need.
however, here is what I was initially starting with.
fString = replace(fString, "[thumb]", "<a href=""#"" onClick=""popImage('files/~images/", 1, -1, 1)
fString = replace(fString, "[/thumb]", "','BSF Image Window','middle_center',true,true);return false;"">need to insert image here somehow</a>", 1, -1, 1) |
|
Edited by - dayve on 28 November 2004 20:41:23 |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 28 November 2004 : 21:10:59
|
just for clarification, here is what I am trying to consolidate into one tag:
[url="files/~images/281104060239_10.jpg"][img]files/~thumbs/thumb_281104060239_10.jpg[/img][/url] |
|
 |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 28 November 2004 : 21:15:29
|
I'm bored enough.... lemme play around with the idea for a little bit and I'll get back to ya :) |
-Stim |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 28 November 2004 : 21:18:28
|
and here is a demo thread of the thumbnails that can be clicked, but this is using the combo url and img forum tags as stated earlier.
http://www.burningsoulsforum.com/forum/topic.asp?TOPIC_ID=10917
once this is done, I'll gladly share the code, but you will need to have the .NET Framework on the server that hosts your forum. |
|
Edited by - dayve on 28 November 2004 21:18:42 |
 |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 28 November 2004 : 21:38:47
|
Okay... did NOT test this at all... cuz I cant really... not sure if it will work, but maybe it will get you headed in the right direction (if it dont work)
Function doThumb(fString)
Dim filePath, t1Tag, t2Tag, midTags, splitStr, endtLoc
Dim thumbPath, thumbImg, repString
filePath = "files/~images/"
thumbPath = "files/~thumbs/"
t1Tag = "[thumb]"
t2Tag = "[/thumb]"
if Instr(fString, t1Tag) and InStr(fString, t2Tag) then
splitStr = Split(fString, t1Tag)
For i=0 to Ubound(splitStr)
endtLoc = InStr(splitStr(i), t2Tag)
midTags = Left(splitStr(i), endtLoc-1)
midTags = replace(midTags, filePath, "")
thumbImg = "thumb_" & midTags
thumbImg = filePath & thumbImg
repString = "<a href=""#"" onClick=""popImage('" & thumbImg & _
"','BSF Image Window','middle_center',true,true);return false;"">" & _
"<img src=""" & thumbPath & midTags & """></a>"
splitStr(i) = replace(splitStr(i), Left(splitStr(i), endtLoc-1), repString)
Next
doThumb = Join(splitStr, " ")
doThumb = replace(doThumb, t1Tag, "")
doThumb = replace(doThumb, t2Tag, "")
end if
End Function
|
-Stim |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 28 November 2004 : 21:51:06
|
quickly popped the function in... it wipes out all the information in all the posts. no errors. examining script now. |
|
 |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 28 November 2004 : 21:59:30
|
hmmm maybe put
else doThumb = fString
Function doThumb(fString)
Dim filePath, t1Tag, t2Tag, midTags, splitStr, endtLoc
Dim thumbPath, thumbImg, repString
filePath = "files/~images/"
thumbPath = "files/~thumbs/"
t1Tag = "[thumb]"
t2Tag = "[/thumb]"
if Instr(fString, t1Tag) and InStr(fString, t2Tag) then
splitStr = Split(fString, t1Tag)
For i=0 to Ubound(splitStr)
endtLoc = InStr(splitStr(i), t2Tag)
midTags = Left(splitStr(i), endtLoc-1)
midTags = replace(midTags, filePath, "")
thumbImg = "thumb_" & midTags
thumbImg = filePath & thumbImg
repString = "<a href=""#"" onClick=""popImage('" & thumbImg & _
"','BSF Image Window','middle_center',true,true);return false;"">" & _
"<img src=""" & thumbPath & midTags & """></a>"
splitStr(i) = replace(splitStr(i), Left(splitStr(i), endtLoc-1), repString)
Next
doThumb = Join(splitStr, " ")
doThumb = replace(doThumb, t1Tag, "")
doThumb = replace(doThumb, t2Tag, "")
else
doThumb = fString
end if
End Function
|
-Stim |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 28 November 2004 : 22:13:14
|
..... hrmmmm.... *examines code*
maybe it's because of the split...
add some words and line breaks and stuff and see if it works, multiple references to [thumb] tag... if thats the case then we'll have to fix it... |
-Stim |
Edited by - Da_Stimulator on 28 November 2004 22:16:46 |
 |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 28 November 2004 : 22:21:16
|
obviously not (saw you edited the post)....
its gotta be this line: if Instr(fString, t1Tag) and InStr(fString, t2Tag) then
because if it wasnt, and it went through the loop, then SOMETHING would have changed. (I would think) |
-Stim |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 28 November 2004 : 22:41:12
|
I commented out the if Instr(fString, t1Tag) and InStr(fString, t2Tag) then and it still did not parse. (yes I also commented out the end if ).
Are you modeling the concept of this script from the ReplaceURLs function? |
|
 |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 28 November 2004 : 22:43:57
|
no... came up with that from scratch (although the memory of that function was in the back of my head)....
sad that I can remember VBScript functions but not that I left the pizza in the oven.
I just double checked it, I dont see why its not working  ..... I'll keep lookin at it and playin with it, see what I come up with.
-edit- If you commented out the if/end if.... it should have removed the [thumb] tags...
doThumb = replace(doThumb, t1Tag, "")
doThumb = replace(doThumb, t2Tag, "")
|
-Stim |
Edited by - Da_Stimulator on 28 November 2004 22:46:23 |
 |
|
dayve
Forum Moderator
    
USA
5820 Posts |
Posted - 28 November 2004 : 22:54:09
|
on a hunch I commented out the on error resume next in the FormatStr function and got this error:
Microsoft VBScript runtime error '800a0005'
Invalid procedure call or argument: 'Left'
/forum/inc_func_common.asp, line 1283
Line 1283 is:
midTags = Left(splitStr(i), endtLoc-1) |
|
 |
|
Da_Stimulator
DEV Team Forum Moderator
    
USA
3373 Posts |
Posted - 28 November 2004 : 22:58:02
|
figures....
I dont know whats wrong with that line...
maybe try Cint(endtLoc-1) |
-Stim |
 |
|
Topic  |
|