Showing posts with label APEX_UTIL.GET_BLOB_FILE_SRC. Show all posts
Showing posts with label APEX_UTIL.GET_BLOB_FILE_SRC. Show all posts

Friday, May 22, 2009

Using APEX_UTIL.GET_BLOB_FILE_SRC on a Public page

I had to show images on a public page. I've used my own procedure to do that, but when the build-in APEX procedure APEX_UTIL.GET_BLOB_FILE_SRC came available, I tend to use that. Last year I blogged about how to show an image on your page with that procedure.

So I already used this method for a while, but this time when I ran the page it didn't show my image. I was sure my code was right, because somewhere else in the application it worked just fine. The only difference was the working page is not a public page, but authentication is required.

It remembered me to a question we got last year on our training, why a picture didn't show up in somebodies APEX application. It was the same problem, the use of APEX_UTIL.GET_BLOB_FILE_SRC on a public page didn't work if it references an item on a page that requires authentication.

So here are the steps to let APEX_UTIL.GET_BLOB_FILE_SRC work on a public page.

1) In this example we are on a Public Page 6.
2) On that page I've an hidden item that looks like this:


3) My code to show the image looks like this: APEX_UTIL.GET_BLOB_FILE_SRC('P6_FILE_BLOB', r.id)

4) You would think the above is enough to let it work, but it isn't as we didn't tell from which table this image is coming from. So I had to create an after submit process that links to the right table. I 've a condition to Never on the process, so it never runs, but apparently the APEX_UTIL.GET_BLOB_FILE_SRC procedure looks at that to figure out from which table the image comes from.

That should be enough to show images on your Public Page using the APEX_UTIL.GET_BLOB_FILE_SRC procedure.