This guide walks through how to configure Specify so that you can export Collection Object Attachment URLs from your Specify Attachment/Asset Server that can link to your images when sharing data internally or with data aggregators. These instructions can be adapted to work with any table’s attachments.
[!warning]
You must have the Specify Asset Server configured and publically accessible. To see if this is the case, try to view several Specify attachments in your web browser.
- In App Resources, go to the
DataObjFormattersresource present in the collection or discipline you are configuring this for. This is most likely under your discipline. See an example.
In the format section, add the following XML snippet:
<format
name="CollectionObjectAttachment"
title="CollectionObjectAttachment"
class="edu.ku.brc.specify.datamodel.CollectionObjectAttachment"
default="true"
>
<switch single="true">
<fields>
<field sep="http://biimages.biodiversity.ku.edu/static/Ichthyology/originals/">attachment.attachmentLocation</field>
</fields>
</switch>
</format>
- Replace
http://biimages.biodiversity.ku.edu/static/Ichthyology/originals/in the above XML snippet with the base URL for your attachments.
[!example] For example, here is another URL for an attachment:
https://demo-assets.specifycloud.org/fileget?coll=sp7demofish&type=O&filename=sp62280762705929643056.att.JPG&downloadname=DDB13-16b.JPGI can safely remove everything following the
filename=as that is where theAttachmentLocationinformation is located.I would replace
http://biimages.biodiversity.ku.edu/static/Ichthyology/originals/with
https://demo-assets.specifycloud.org/fileget?coll=sp7demofish&type=O&filename=`
Replace ampersands (
&) with its XML equivalent,&.
As you may have known, the
AttachmentLocationfield contains the actual name given to the attachment by Specify when it is added to the asset server:By establishing this format, we are making it so that this is added to the end of the attachment base URL so that the images can be linked to from external sources (GBIF, iDigBio, etc.).
- In the aggregator section, add the following XML snippet:
<aggregator name="CollectionObjectAttachment"
title="CollectionObjectAttachment"
class="edu.ku.brc.specify.datamodel.CollectionObjectAttachment"
default="true"
separator=" | "
ending=""
count="0"
format="CollectionObjectAttachment"
orderfieldname="ordinal"
/>
-
In the Schema Config tool, navigate to the
CollectionObjectAttachmenttable:ex. https://sp7demofish.specifycloud.org/specify/schema-config/en/CollectionObjectAttachment/
Once there, choose both the
CollectionObjectAttachmentaggregation and format. -
Click Save in the top right of the schema config window, clear your cache, then run a query! You should now see the format and aggregation in action!



