Automation Professionals' Blob Server Module

Thanks, I will try to implement this solution at a time when the application is not in use. Out of curiosity, I was just wondering why removing the # from the file name didn't work. For example, if the file name was 'Booth#32.png', the file name excluding the # seemed like it would work fine as it was just 'Booth32.png'.

Share more details.

The query used to pull the files utilizes the SubmissionID of the photo and the filename within the where clause. When saving these files I tried parsing the '#' out of the file name as I figured that was what caused the error (as you have mentioned special characters in the URL). I had uploaded the same file that included the '#' with the new logic to exclude '#', but it still returned an error.

I still can't see what you are seeing.

Show your named query.

Show a sample URL.

Show what you get in the NQ testing tab with those parameters.

Sorry, it was just a mistake in my testing. Please disregard my previous replies. Thank you for all the help.

@pturmel This is a wonderful module, simplifies code and property bindings. It also loads pictures much faster. Many thanks!

I do have one issue, when I update the image in the database table (through another scripted component), the id is the same and the blob content changes, however the image on screen doesn't refresh unless I do a significant change such as the following:

  • In the Perspective App - refresh the screen by swiping down for more than a few seconds to refresh project resources
  • In Designer, close and reopen View
  • In browser - reload page, which reloads project resources

*Note that my named query is setup as simple as the instructions with no other extra columns.

I tried refreshing the bindings and clearing cache on that named query, but doesn't help, any way to get this to update the picture without having to reload project resources?

Most likely you need to refresh the binding of the image component. Or refresh the binding of the SQL Query. You can test this by turning ON polling for the query and see if the image changes automatically.

My binding is an expression string of the url, not an actual named query binding, so won't be able to use the poll property.
I also tried doing a refreshBinding call to the binding, but doesn't help.

Ah. Ok. You can actually send any additional parameter in the URL even if it isn't used by the named query. That additional parameter could be bound to a timer to refresh the image every X seconds or so. The changing of the URL would cause the image component to refresh.

https://yoururl.com/system/blob/yourproject/yournamedquery?param1=1&id=uniqueIDofImage

1 Like

There are two caching behaviors that can make this happen:

  • Browsers cache URLs that exactly match. Add a "throw-away" random parameter to the URL to avoid this.

  • Named queries have optional caching themselves, with configurable timeout. Disable this caching if applicable.

However, I strongly recommend you not do either of these mitigations. Instead, avoid updating images already placed in your DB. Create new rows in the images table with a new primary key and update any other tables that pointed to the old images. (Images should not be placed in tables with other content.)

I do have caching disabled (tried with it on and clearing it through script, but no difference).

I originally tried adding an extra parameter other than id that could act as a 'refresh' or 'change', and toggled it on the view, no difference, but I'll try again.

My image table only has id and the image columns.

As for updating vs adding a new row, that would definitely fix this, but I don't want my image table to build up with too many extra images. On upload, I have a script that reduces the size of images so they are not full size which helps, but I still don't like the thought of adding additional images with previous images remaining with no associations.

Then delete them. At the time of replacement, perhaps. Or a regular cleanup.

That would work as well.

Any reason for not recommending a throw away parameter in the url?

I was able to get this working by including the now(1000) expression as such:

'https://serverAddress/system/blob/projectname/path/tonamedQuery?id='+{view.params.imageId}+'&refresh='+now(1000)

Since I have this image on several different views, I may end up creating a custom parameter and toggling it via a send message on demand when changed instead of the now(1000) that updates constantly.

Because you want browsers to cache these images as you navigate back and forth. It dramatically improves the user experience, and reduces traffic to the gateway.

3 Likes

Is this still available?

Yes, most recent link was in comment #46. Here's a repeat for everyone's convenience:

v1.1.0.231421939

Is there a way to use this module to load images directly on a Perspective table?

I have the module working with a image component here:

When setting a binding on a table however I get the following result:

The binding on population in the above screenshot is as follows:

What I would like to see is a picture of the American Flag in this example in the cell where Population goes.

Use column view rendering. Create a simple view that accepts a image id as its value parameter. Place an image component in that view, and construct its URL to point at my module, passing the image ID as an argument.

In the table, supply the image ID in a column, set the column to render by view, and set the view path to your image display view.

Do NOT use a HTTP binding.

1 Like

Got it working. I'll have to make some future adjustments but thank you for the initial guidance.

A customer is asking to use the module. My understanding is the module is free to use commercially?

Yes.

5 Likes