setting img size

C

carmen

I need to set the image size in the following line. When I try to set the
img to 75x75 I am getting an error. The line I'm having problems with is :

Response.Write "<a href='" & imageFilePath & strPicArray(0,x) & "'><img
src='" & thumbFilePath & strPicArray(0,x) & "'width="75" height="75"></a>"

Thanks
C
 
R

Ray Costanzo [MVP]

It's often helpful to tell us what the error is. Luckily, in this post,
it's easy enough to guess that the error probably mentions something about
an expected end of statement.

The problem is that you're trying to put " characters in a string, that is
begun and ended with the " character (width and height attributes). So, how
is the server supposed to know when a " means that you want to write a " and
when a " means that it's the beginning or end of the argument you're passing
to response.write?

The way to "escape" the " character when using VBScript is by doubling it
up.

Response.Write "<a href='" & imageFilePath & strPicArray(0,x) & "'><img
src='" & thumbFilePath & strPicArray(0,x) & "'width=""75""
height=""75""></a>"

Also, I suggest you not use ' for your attribute values. That's just the
lazy way out that people like to use. I suggest one of these two lines:

1.
<%
Response.Write "<a href=""" & imageFilePath & strPicArray(0,x) & """><img
src=""" & thumbFilePath & strPicArray(0,x) & """ width=""75""
height=""75""></a>"
%>

2.
%>
<a href="<%=imageFilePath & strPicArray(0,x)%>"><img src="<%=thumbFilePath &
strPicArray(0,x)%>" width="75" height="75" /></a>

Ray at work
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,048
Latest member
verona

Latest Threads

Top