# How does Specify 7 work with the Web Asset Server?

**URL:** <https://speciforum.org/t/how-does-specify-7-work-with-the-web-asset-server/2817>\
**Category:** Technical Docs\
**Tags:** Specify-7\
**Created:** [September 2, 2025, 5:48pm UTC](https://speciforum.org/t/how-does-specify-7-work-with-the-web-asset-server/2817 "2025-09-02T17:48:44Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Grant](https://yyz1.discourse-cdn.com/flex029/user_avatar/speciforum.org/grant/32/4255_2.png) [@Grant](https://speciforum.org/u/Grant)\
**Post date:** [September 2, 2025, 5:48pm UTC](https://speciforum.org/t/how-does-specify-7-work-with-the-web-asset-server/2817/1 "2025-09-02T17:48:44Z")

</div>

> 📖 This article describes how attachments in Specify are linked to attachments on the [Web Asset Server](https://speciforum.org/t/specify-attachment-server-asset-server/715).

## Linking an Attachment to the Source

When an attachment is uploaded to Specify, it is added to the database as a set of attachment records (in the `attachment` table and the joining attachment table, in this case `collectionobjectattachment`). In this example, I uploaded an attachment for a Collection Object with the catalog number `29499`:

 ![Puntius sophore (Hamilton, 1822) specimen](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/a/a8f29dec9e8974f57afb924a40d5147a2b200be4.jpeg)

 

**Citation:** University of Kansas Biodiversity Institute: KUBI Ichthyology Collection [https://doi.org/10.15468/mgjasg](https://doi.org/10.15468/mgjasg).  
 [https://www.gbif.org/occurrence/656963381](https://www.gbif.org/occurrence/656963381)

You can build a simple query to show the attachment location, which is what Specify uses to look up the image on the asset server:

 ![CO Attachment Query mapping](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/f/fbaf3779999f670dca350e18f15946848c5920b4.png)

You can download this query here: [CO Attachment.json](https://speciforum.org/uploads/short-url/1PTHEg8NqHqLfaofeeNDcFBBHi8.json) (3.2 KB), ([How to Import a Query](https://speciforum.org/t/export-and-import-a-query/1227))

See that the results show the original filename (the name given to the attachment before it was uploaded) and the _actual_ attachment location (what it is named on the Web Asset Server):

 ![CO Attachment Query Results](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/9/9caaedab9cc1d5d353dc4b0036e13fdf395ca814.png)

To find the attachments on the Web Asset Server, I need to now construct the appropriate URL to retrieve the image. In this case:

- The thumbnail is available at: [https://assets-test.specifycloud.org/fileget?coll=sp7demofish&type=T&filename=sp64504250189672699317.att.JPG&scale=123](https://assets-test.specifycloud.org/fileget?coll=sp7demofish&type=T&filename=sp64504250189672699317.att.JPG&scale=123)
- The original is available at: [https://assets-test.specifycloud.org/fileget?coll=sp7demofish&type=O&filename=sp64504250189672699317.att.JPG&downloadname=29499.JPG](https://assets-test.specifycloud.org/fileget?coll=sp7demofish&type=O&filename=sp64504250189672699317.att.JPG&downloadname=29499.JPG)

## Technical Configuration

Specify builds URLs to obtain assets from the Web Asset Server differently depending on the context (either full resolution or thumbnail). The URLs are constructed with the following parameters:

- **Base URL** (`baseUrl`): comes from the attachment server settings (e.g., `https://assets-test.specifycloud.org`) for the Specify 7 service ([configured in Docker](https://speciforum.org/t/self-hosting-specify-7/2591#p-5023-supported-customization-environment-variables-9)).
- **Collection** (`coll`): the collection key for the database (e.g., `sp7demofish`) ([configured in Docker](https://speciforum.org/t/self-hosting-specify-7/2591#p-5023-supported-customization-environment-variables-9)).
- **Filename** (`filename`): the server-side stored filename from each Attachment record (from the `attachmentLocation` field in the `attachment` record directly)
- **Type** (`type`): `T` for thumbnails/previews used in the gallery, originals use `O`. If `T`, you **must** add the `scale` component.
- **Scale** (`scale`): The size of the thumbnail to generate. Only used for thumbnails.
- **Download Name** (`downloadname`): Optional, you can specify the download name for the image.

Putting it together, a URL like this will make it possible to download the original attachment at full resolution:

```auto
${baseUrl}/fileget?coll=${coll}&type=O&filename=${filename}

```

and this will get you the thumbnail:

```auto
${baseUrl}/fileget?coll=${coll}&type=T&filename=${filename}&scale=123

```

Optionally, you can specify a download name for the image which will be used automatically if the image is saved to the viewer’s computer. By default, this is the `title` value from `attachment` when accessed via Specify directly.

This works for both originals and thumbnails:

```auto
${baseUrl}/fileget?coll=${coll}&type=O&filename=${filename}&downloadname=${downloadname}

```

## Find Attachments on the Asset Server

Once you have [navigated to the directory the Web Asset Server is configured to grab attachments from](https://github.com/specify/web-asset-server/blob/3e1847646df6cb0d7e95d6f72bf1b86916a16b27/settings.py#L54), you should see two directories: `originals` and `thumbnails`

_Note: If you have separated attachments into different directories based on the collection, there may be an intermediary directory with [the name set here](https://github.com/specify/web-asset-server/blob/3e1847646df6cb0d7e95d6f72bf1b86916a16b27/settings.py#L45-L49). This is not the configuration by default and is not generally recommended._

- `originals` stores the full resolution, uncompressed images that were uploaded to Specify
- `thumbnails` stores the “thumbnailified” images, usually named the same as the original with a suffix indicating the resolution (e.g. `_123` in the filename indicates it is a 123x123 thumbnail).

For each original, there can be one or more thumbnails, depending on whether multiple sizes were created.

### Originals

You can navigate into the `originals` directory, where you can find the attachment by simply searching for the `attachmentLocation` in the Attachment record from Specify (returned in the query results shown above):

```auto
example@assets-test:~/attachments/originals$ ls | grep sp64504250189672699317.att.JPG
sp64504250189672699317.att.JPG

```

### Thumbnails

For thumbnails, they are generated on-demand by grabbing the original attachment and downsizing it to the resolution specified. If a thumbnail at that resolution already exists, it will simply display it. If not, it will create a new one.

> [!example] Supported Filetypes  
> While Specify supports any filetype attachments, not all attachments can have thumbnails created for them. Currently, the following are “thumbnailable”:
> 
> - JPEG
> - GIF
> - PNG
> - TIFF
> - PDF

If images have been imported in bulk using an external tool to Specify, thumbnails will not be generated until a user tries to view the thumbnail for that image in Specify. Every supported attachment uploaded directly in Specify will automatically have thumbnails created for them.

If I go to an asset server URL ending with `123` (e.g. `filename=sp64504250189672699317.att.JPG&scale=123`), it will generate a `123x123` thumbnail. If I modify the URL to end in `512` (e.g. `filename=sp64504250189672699317.att.JPG&scale=256`), it will generate a `256x256` thumbnail.

Now within the configured attachment directory for the collection/database, you can find both a thumbnail at `123x123` and `256x256`:

```bash
example@assets-test:~/attachments/thumbnails$ ls | grep sp64504250189672699317
sp64504250189672699317.att_123.JPG
sp64504250189672699317.att_256.JPG

```

You can modify what size thumbnails are generated by updating the ‘Remote Preferences’ [App Resource](https://speciforum.org/t/app-resources-in-specify-7/582) at the “Global Resources” level to change which is made automatically. For this change to go into effect, make sure to log out and back in. Please note that it might take some time to regenerate all thumbnails.

 ![Modified attachment preview size](https://canada1.discourse-cdn.com/flex029/uploads/specifysoftware/original/2X/d/d58d2dcb47b57c0ec62b0b2bc6496e1e751565ec.png)

```auto
attachment.preview_size=123 # this is the default

```
