cancel
Showing results for 
Search instead for 
Did you mean: 

Change Image Dynamically

Former Member
0 Kudos

Hi guys,

I need to change an image dynamically.

I know I can display an Image by supplying the abolute URL like: http://sapcookbook.com/store/images/wd-abap_book.png But say I want to display an image in the following location (which is an internal shared file on a company server): *
hafXXX.wX\Files\WA\RenderFull.jpg*

Please advise on how I could go about retrieving this file. I have tried various ways...

Thanks,

Christiaan

Accepted Solutions (1)

Accepted Solutions (1)

ChrisPaine
Active Contributor
0 Kudos

Hi Christiaan,

If the file is accessible from the SAP server using "open dataset" commands, then just read it and expose it using a temporary web cache then pass the generated URL to the image source.

If you can't read it from the SAP server, ACFUpDownload and then then same thing.

Could you let us know what various ways you have tried?

Chris

Former Member
0 Kudos

Hi Chris,

Thanks for your reply.

Currently, my application is working exactly as you recommended. I save an uploaded image (using the FileUpload UI) to the SAP AS using "open dataset for output". When I read it I use "open for input" and generate a temp URL. This temp url is then linked to the Image UI. This is all working 100%.

My reason for searching alternative techniques for accomplishing this is because I'm worried about system resources on the server where the URL caching is taking place... I guess I'm being overly paranoid about it! Some of the pictures that are being displayed can be up to 16MB.. I'm worried that If URL's reqeusting cache space of this proportion are constantly being generated that the server might crash or something!!

Please advise if I am worrying unnecisarily about this, or if you can recommend something.

Kind Regards,

Christiaan

thomas_jung
Developer Advocate
Developer Advocate
0 Kudos

It is a common approach to this requirement, but you are correct that if you have a large amount of images and frequent usage it can dominate a server cache u2013 especially if that cache is too small. This could cause the flushing of key framework libraries from this cache resulting in lower performance.

There is an alternative which I would suggest if you are concerned about this situation. You can create a custom handler class for your images. This way each image has a unique URL based upon the image name and doesnu2019t use the ICM cache.

Answers (0)