Forums

ASP

This topic is locked

Help with text string

Posted 28 Jan 2008 16:02:30
1
has voted
28 Jan 2008 16:02:30 phil C posted:
Hi all, hope someone can help with this little task.
i want to be able to convert a text string something like "This & That" from a url query into correspondingly named gif's ie T.gif h.gif i.gif etc.

i suspect i need to use len,split and Ubound with an array and loop but i have no idea how.....
Why you may ask...
i am working on a site that produces custom studded belts and i need to show a preview of the belt which uses a custom designed font to display the studs arranged as letters, i could just embed the custom font but that wont work in all browsers so i intend to create a full set of images a-z 0-9 & etc. then convert the text string to local var and code a loop something like :

<%
arrText = "This"
textLen = len(arrtext)
Response.Write("<table border=1><tr>"
for i = 0 to textLen
Response.Write("<td><img src='images/"& arrtext &".gif'/></td>"
next
response.Write("</tr></table>"
%>

this works but i need to break to string down to individual letters...
Note.. the script must be able to cope with spaces and & * ( ) % ? @ etc..
or can you suggest an alternative way of converting a text string to an image using custom font?

Edited by - filco on 28 Jan 2008 17:19:55

Edited by - filco on 28 Jan 2008 17:24:03

Replies

Replied 28 Jan 2008 18:44:06
28 Jan 2008 18:44:06 Vince Baker replied:
when you send your text in the text string I am unsure about how you mean it is sent.....

normally you would send something through in a querystring with a delimiter allowing easy seperation on the receiving page

eg. page.asp?vars=T,G,S,A

This way you can set an array like:

<%
Dim arrReceived = split(Request.Querystring("vars", ","

for i = 0 to ubound(arrRecieved)

response.write(arrReceived(0) & ".gif"

next

%>


Can you change your querystring to do something like above?

Regards

Vince Baker
<strong>DMX Zone Manager</strong>

[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
Replied 28 Jan 2008 18:51:15
28 Jan 2008 18:51:15 phil C replied:
Hi
the string is a normal text string sent from a form ie
page.asp?text=this is my text
Replied 28 Jan 2008 18:54:24
28 Jan 2008 18:54:24 Vince Baker replied:
so are the images basically letters? so you build up the text sent as a series of images?

Can you give me an example?

Regards

Vince Baker
<strong>DMX Zone Manager</strong>

[VBScript | ASP | HTML | CSS | SQL | Oracle | AS400 | ERP Logic | Hosting]
Replied 28 Jan 2008 18:59:30
28 Jan 2008 18:59:30 phil C replied:
the code example is at www.selectdesigns.co.uk/text.asp

yes, i want to replace the text string with a line of images to replace each letter.
Replied 28 Jan 2008 19:00:41
28 Jan 2008 19:00:41 phil C replied:
each of the boxes should contain one letter not the whole word

Reply to this topic