Important Notice from AspDotNetStorefront
It is with dismay that we report that we have been forced, through the action of hackers, to shut off write-access to this forum. We are keen to leave the wealth of material available to you for research. We have opened a new forum from which our community of users can seek help, support and advice from us and from each other. To post a new question to our community, please visit: http://forums.vortx.com
Results 1 to 5 of 5

Thread: Images width and height

  1. #1
    medsupply is offline Senior Member
    Join Date
    Jul 2011
    Posts
    99

    Default Images width and height

    How can I harcode the product image width and height in the xml package so that it renders in the html source?

    Our images html code are: <img src="images/xxxxx.jpg" alt="whatever">

    There is no width and height.

    Can somebody please help?

  2. #2
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    Default

    Something like this in the XML package (typing directly so might need fixing slightly)

    <img src="[url of the image]" alt="[title of the image]">
    <xsl:attribute name="width">[put width here]</xsl:attribute>
    <xsl:attribute name="height">[put height here]</xsl:attribute>
    </img>

  3. #3
    medsupply is offline Senior Member
    Join Date
    Jul 2011
    Posts
    99

    Default

    I should have posted the tag that we have in the xml package to display the image:

    <xsl:value-of select="aspdnsf:LookupProductImage(ProductID, ImageFilenameOverride, SKU, 'icon', 1, $AltText)" disable-output-escaping="yes"/>

    I am not sure if your solution will work here

  4. #4
    webopius is offline Senior Member
    Join Date
    Nov 2008
    Location
    London, UK
    Posts
    440

    Default

    That's fine. Just use aspdnsf:ProductImageUrl() instead so that you get full control... something like this (again, I'm typing without looking at code so it may need correcting)

    <img alt="[title of the image]">
    <xsl:attribute name="src">
    <xsl:value-of select="aspdnsf:ProductImageUrl(ProductID, ImageFilenameOverride, SKU, 'icon', 0)" disable-output-escaping="yes"/>
    </xsl:attribute>
    <xsl:attribute name="width">[put width here]</xsl:attribute>
    <xsl:attribute name="height">[put height here]</xsl:attribute>
    </img>

  5. #5
    medsupply is offline Senior Member
    Join Date
    Jul 2011
    Posts
    99

    Default

    I got it! :-)

    Here is my code after some adjustments:

    Code:
    <a href="{aspdnsf:ProductLink(ProductID, SEName, 0, '')}">
    <img>
    <xsl:attribute name="alt"><xsl:value-of select="aspdnsf:GetMLValue(Name)" /></xsl:attribute>
    <xsl:attribute name="src">
    <xsl:value-of select="aspdnsf:ProductImageUrl(ProductID, ImageFilenameOverride, SKU, 'icon', 0)" disable-output-escaping="yes"/>
    </xsl:attribute>
    <xsl:attribute name="width">150</xsl:attribute>
    <xsl:attribute name="height">150</xsl:attribute>
    </img>
    </a>


    Thanks a lot!!!!