Help with ImageResize function (Full Version)

All Forums >> [Web Development] >> ASP and Database



Message


octavious -> Help with ImageResize function (4/12/2008 11:50:39)

Im using the ImageResize function to display images uploaded by users to a specific dimension. However, I went one step further providing them an option to display the image in its original size or the specs applied by the ImageResize.

My problem is that I cant seem to find the correct format to make this function work within an IF.. THEN statement.

This is my statement to simply apply the ImageResize:

<img border="0"  src="../photos/<%=ImageName%>"<%=ImageResize(Server.MapPath("../photos/" & <%=ImageName%>),55,65)%> alt="<%=ImgTitle%>">


This is my IF.. THEN statement that I cant seem to format or get to work properly:

<%
IF XDSPFORMAT=2 THEN 
RESPONSE.WRITE "<img border='0' src='../photos/"&XIMAGENAME&"'> "  
ELSE IF XDSPFORMAT=1 THEN 
RESPONSE.WRITE "<img border='0' src='../photos/"&XIMAGENAME&" ' "&ImageResize(Server.MapPath('../photos/' & "&XIMAGENAME&" ),525,525)&" > "  
END IF 
%>


The first statement (XDSPFORMAT=2 ) works fine, but the second statement is not working for me. I'm sure it's just some type of formatting error. This is the error I get:

Microsoft VBScript compilation error '800a03ea'
Syntax error
editphoto.asp, line 226

RESPONSE.WRITE "<img border='0' src='../photos/"&XIMAGENAME&"' "&ImageResize(Server.MapPath('../photos/' & "&XIMAGENAME&" ),525,525)&" > "
--------------------------------------------------------------------------------------------^


I have tried several different variations of the quotes and ampersands and cant seem to get this function to work within an ASP statement.

Any help would be greatly appreciated!!


Thanks,

O:)





rdouglass -> RE: Help with ImageResize function (4/12/2008 12:16:04)

quote:

"&ImageResize(Server.MapPath('../photos/' & "&XIMAGENAME&" ),525,525)&"


Hiw 'bout this?

..."&ImageResize(Server.MapPath("../photos/" & XIMAGENAME ),525,525)&"...

That any better?




octavious -> RE: Help with ImageResize function (4/12/2008 13:54:24)

Awesome dude!

Just for those that may want to use this, here is the final code. I actually needed to place it all in one line as well:


<% IF XDSPFORMAT=2 THEN RESPONSE.WRITE "<img border='0' src='../photos/"&XIMAGENAME&"'> " ELSE IF XDSPFORMAT=1 THEN RESPONSE.WRITE "<img border='0' src='../photos/"&XIMAGENAME&" ' "&ImageResize(Server.MapPath("../photos/" & XIMAGENAME ),525,525)&" > " END IF %>	


Thanks again..... O:)




Page: [1]

Valid CSS!




Forum Software © ASPPlayground.NET Advanced Edition 2.4.5 ANSI
0.15625