Skip to main content

Hi.

I have been assigned the task of importing 4000+ images from a remote service into a local Postgres database. An obvious FME task.

Fetching the images with ImageFetcher runs smoothly, but here starts my problems:

- I need to store the MIME type, but although ImageFetcher is set to auto-detect this, it never reveals it in the output. And no file extension is available, and no other transformer offers that service, so an improvement to ImageFetcher is warranted, I think.

- I need to store the image in a text column in base64 format, but a combination of GeometryExtractor (FME Binary) + TextEncoder (Base64) doesn't really seems to work.

The output should look like this: data:image/jpeg;base64,/9j/........

Is there a better way to accomplish my task ?

Cheers

Have you looked at using a HTTPcaller instead, you can store the response body directly as binary then and the response headers can be stored in a list


Have you looked at using a HTTPcaller instead, you can store the response body directly as binary then and the response headers can be stored in a list

Yeah, I got around to doing that. It seems like the only way.

 

Unfortunately, the output is still off, it seems, so maybe I'm still not getting the encoding right.

 

 


HTTPcaller with response body as binary followed by a BinaryEncoder should get the encoding right, then you just need to construct the output with the data from the headers

image-to-base64.fmw


HTTPcaller with response body as binary followed by a BinaryEncoder should get the encoding right, then you just need to construct the output with the data from the headers

image-to-base64.fmw

Can you insert into a MS SQL table (VARBINARY(MAX)) using SQLExecutor? if so how did you do it?


Reply