OL Learn

How do I change the default img image displayed when a file is not found in a Print Context

The default image is a red circle with an X in the center. The customer would like none or an image of their choice. Currently this is html being created within the script manager with a new image tag, based on csv data.

I am hoping for a Connect solution / answer, as I would prefer not to script this in Workflow.

Hello, I’ve check over the web and the following solution is neat:

<img onerror=“src=‘images/default.jpg’” src=“images/theImage.jpg”>

Default.jpg will appear whenever the main image is unavailable. You will have to add this for every images. At design you still see the X but at run time, the default image will show. Of course, make sure that the default image is available. Having it as part of your resources would be the most logical way.

I am trying that method and it is not taking.

I am not sure if it’s because I only have a print context or if it’s that, plus the html for the img tag is being built dynamically in the script pane.

Make sure to check the syntax since you are building it dynamically. HTML has a way of doing nothing when syntax is wrong…double-check single-quote VS double-quote and so on…

I moved over to a blank page and it was not what I was doing. It’s a problem with the print context. It works with the web context.

I created a blank web context and a blank print context. Added the text below, but it only worked in the web context.

Anyone from OL want to shine in?

Unfortunatly, while going further into your request an actual limitation was found. It will be bypass in the future. Sadly I do not have a workaround as of now nor do I have an ETA to provide.

Thank you for looking into this further.

saturn

I always do…even if it takes some time…:wink:

hello I think the on error function is still unavailable in this regard? Is there an alternative solution?

Found this post on the resource() function…

http://help.objectiflune.com/en/pres-connect-user-guide/1.8/#designer/API/resource.htm?Highlight=resource

Seems you can use the resource function to check if the file exists and just use some IFs to control which image is returned.

Hope this helps.