In my widget, I want to display attachment image on to customer portal page. I have created a custom object called 'Events'.All events must have images. So I stored images as attachments. Now we want to display attachment image as thumbnail So I need URL of attachment. I don't how to get URL of attachment.
File attachments aren't exposed to the web server, so you cannot simply reference a path to serve the image based on your object id. You could implement an API call from the controller/widget that queries for the file attachment and then inserts the image into the DOM. This could be done server-side with CPHP; use the FileAttachment sub-object on your custom object to collect the base64 encoded data of the image and then output it in the DOM. Alternatively, you could call the REST API through JavaScript and update the DOM during/after page load to get the image.