Geographic Information Systems Stack Exchange is a question and answer site for cartographers, geographers and GIS professionals. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm diving into using the HTML popup in ArcGIS 10 and I'm trying to figure out how I can get an image to appear. I have a point file that contains the field "Coll" that has a image name with no extension ("100015"). All the images are stored in a directory ("T:\SEFIS2010_GVdata\SEFIS Video"). I can make an image appear in the popup using this XSL code

<xsl:when test="FieldName[starts-with(., 'Coll')]">
    <img src="T:\SEFIS2010_GVdata\SEFIS Video\100015.jpg"/>
</xsl:when>

but what is the syntax to append the directory, the FieldName, and the ".jpg" extension?

share|improve this question
up vote 3 down vote accepted

This was the code I ended up using inside one of the XSL samples.

<xsl:when test="FieldName[starts-with(., 'Coll')]">
    <xsl:variable name="imageName" select="FieldValue"/>
    <img src="T:\SEFIS2010_GVdata\SEFIS Video\{$imageName}.jpg" width="192" height="108"/>
</xsl:when>

Edit This is the full XSL code where this is used

<?xml version="1.0" encoding="UTF-8"?>
<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform" xmlns:fo="http://www.w3.org/1999/XSL/Format">
    <xsl:template match="/">
        <html>
            <head>
                <meta http-equiv="content-type" content="text/html; charset=UTF-8"/>
            </head>
            <body>
                <xsl:variable name="nameCol" select="FieldsDoc/Fields/Field/FieldName"/>
                    <table border="1" width="300" cellpadding="5" cellspacing="0">
                        <tr bgcolor="#9cbce2">
                            <xsl:if test="string-length($nameCol) != 0">
                                <th width="50%" align="left">Field Name</th>
                            </xsl:if>
                            <th width="50%" align="left">Field Value</th>
                        </tr>
                        <xsl:variable name="index" select="1"/>
                        <xsl:for-each select="FieldsDoc/Fields/Field">
                            <tr>
                                <xsl:if test="string-length($nameCol) != 0">
                                    <td bgcolor="#D4e4f3">
                                    <xsl:value-of select="FieldName"/>
                                    </td>
                                </xsl:if>
                                <td>
                                    <xsl:choose>
                                        <xsl:when test="FieldValue[starts-with(., 'www.')]">
                                            <a target="_blank"><xsl:attribute name="href">http://<xsl:value-of select="FieldValue"/>
                                            </xsl:attribute><xsl:value-of select="FieldValue"/>
                                            </a>
                                        </xsl:when>
                                        <xsl:when test="FieldValue[starts-with(., 'http:')]">
                                            <a target="_blank"><xsl:attribute name="href"><xsl:value-of select="FieldValue"/>
                                            </xsl:attribute><xsl:value-of select="FieldValue"/>
                                            </a>  
                                        </xsl:when>
                                        <xsl:when test="FieldValue[starts-with(., 'https:')]">
                                            <a target="_blank"><xsl:attribute name="href"><xsl:value-of select="FieldValue"/>
                                            </xsl:attribute><xsl:value-of select="FieldValue"/>
                                            </a>  
                                        </xsl:when>
                                        <xsl:when test="FieldValue[starts-with(., '\\')]">
                                            <a target="_blank"><xsl:attribute name="href"><xsl:value-of select="FieldValue"/>
                                            </xsl:attribute><xsl:value-of select="FieldValue"/>
                                            </a>  
                                        </xsl:when>
                                        <xsl:when test="FieldName[starts-with(., 'Coll')]">
                                            <xsl:variable name="imageName" select="FieldValue"/>
                                            <img src="T:\SEFIS2010_GVdata\SEFIS Video\{$imageName}.jpg" width="192" height="108"/>
                                        </xsl:when>
                                        <xsl:otherwise>
                                            <xsl:value-of select="FieldValue"/>
                                        </xsl:otherwise>
                                    </xsl:choose>
                                </td>
                            </tr>
                        </xsl:for-each>
                    </table>
                <br/>
            </body>
        </html>
    </xsl:template>
</xsl:stylesheet>
share|improve this answer
    
Hi @kenbuja. I've been trying to work this out. Traditionally I have a point shape file and one field is the full path to a jpeg, e.g. field is called filepath and the value in the row might be c:\temp\rubbish.jpg. I can set this up no problem as a hyperlink but I now want to display it as a HTML popup. Your answer above seems to be the solution but I do know where you insert this code? I have loaded the default template but where does what you describe above go? Could you update your answer, may be with a full example of the code? – Hornbydd Apr 28 at 14:50
1  
I've updated the answer to show the full XSL code – kenbuja Apr 28 at 16:30
    
I have never used XSL style sheets before and it's quite cryptic so seeing a nice simple clear cut example has been extremely helpful, thanks! I have now been able to get my picture to show up and have some vague idea of what it all means! – Hornbydd Apr 28 at 16:53

When setting up the HTML popup, check "As a URL" and then fill out the info. For example, I created a map that had PDFs pop up when you clicked on a point. To do that, just put all the PDFs in one directory, make sure the field corresponds with the correct PDF file name, and then add ".pdf" for the suffix. This should work fine with your example, just format it for .jpg

share|improve this answer
    
Thanks, Matt, but that doesn't quite get me there. The image shows up in the Verify window, but the Identify dialog is not showing the image. And I'd like to see the other attributes of the point. – kenbuja Mar 22 '12 at 18:51

If you enable attachments for the feature class and add the photo for every point you can then use the option to display HTML pop-up windows as a table of visible fields, feature class attachments will be displayed automatically as part of the pop-up window. Turn on the HTML popup in the Tools toolbar. When you click on the point you should get the image and all the attributes associated.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.