troubleshooting Question

Get image width in Classic ASP

Avatar of Martin Cotterill
Martin CotterillFlag for United Kingdom of Great Britain and Northern Ireland asked on
ASP
8 Comments2 Solutions1459 ViewsLast Modified:
Hi all

Here's the code I'm using at the moment:

<article>
<%
IF (rsPageContent.Fields.Item("ArticleImage").Value) <> "" THEN
%>
    <figure> <img src="images/<%=(rsPageContent.Fields.Item("ArticleImage").Value)%>"> </figure>
    <h1><%=(rsPageContent.Fields.Item("ArticleTitle").Value)%></h1>
    <%=(rsPageContent.Fields.Item("ArticleContent").Value)%>
<%
ELSE
%>
    <h1><%=(rsPageContent.Fields.Item("ArticleTitle").Value)%></h1>
    <%=(rsPageContent.Fields.Item("ArticleContent").Value)%>
<%
END IF
%>
</article>

What I'm after is something along the lines of ...

<article>
<%
IF (rsPageContent.Fields.Item("ArticleImage").Value) <> "" THEN
%>
    <figure> <img src="images/<%=(rsPageContent.Fields.Item("ArticleImage").Value)%>"> </figure>
    <h1><%=(rsPageContent.Fields.Item("ArticleTitle").Value)%></h1>
    <%=(rsPageContent.Fields.Item("ArticleContent").Value)%>

' New code here...
<%
    ELSE IF width of (rsPageContent.Fields.Item("ArticleImage").Value) < 400px THEN
%>
    <h1><%=(rsPageContent.Fields.Item("ArticleTitle").Value)%></h1>
    <img src="images/<%=(rsPageContent.Fields.Item("ArticleImage").Value)%>" class="storyImage"><%=(rsPageContent.Fields.Item("ArticleContent").Value)%>

' Continuation of code
<%
ELSE
%>
    <h1><%=(rsPageContent.Fields.Item("ArticleTitle").Value)%></h1>
    <%=(rsPageContent.Fields.Item("ArticleContent").Value)%>
<%
END IF
%>
</article>

Hope it makes sense.

Thanks in advance

Pb
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 2 Answers and 8 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 2 Answers and 8 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros