In a scenario i need to make a URL that takes user to a Picture. Then i thought what if we put a small picture in place of a text and make picture a URL.
Although i had no idea but from bookshelf i know i must start with IMAGE(image url, alternate_txt, height, width) Function and a formula field.
so i created a formula like this:
IMAGE( "https://c.ap1.content.force.com/servlet/servlet.FileDownload?file=" & Picture_ID__c , "Picture")
Lets check how this function work. first part is the address of the picture that i stored in documents area, to grab url specific to your environment just go to Documents Tab file location and click view image and copy the url from address bar. To make it dynamic i used a Picture_ID field as a place where Image id is to be stored then appended with the URL using concatenating operator(&) and at last the Text("Picture") that will act as a hover text.
At this point i check and found full size image in page layout that make no sense of making link if original image shown at first place.
So i changed formula field look like
IMAGE( "https://c.ap1.content.force.com/servlet/servlet.FileDownload?file=" & Picture_ID__c , "Picture", 25,25)
I added last optional arguments of IMAGE() formula height and width.
This part of formula will only show image now we need to make it hyperlink so i changed formula as below
HYPERLINK("/servlet/servlet.FileDownload?file=" & Picture_ID__c, IMAGE( "https://c.ap1.content.force.com/servlet/servlet.FileDownload?file=" & Picture_ID__c , "Picture", 25,25))
In this HYPERLINK function first part can be the same link that we provided in IMAGE function and second part is the Image that we want to make as a link. so whenever we click on image the original size image will be shown in new window.
Although i had no idea but from bookshelf i know i must start with IMAGE(image url, alternate_txt, height, width) Function and a formula field.
so i created a formula like this:
IMAGE( "https://c.ap1.content.force.com/servlet/servlet.FileDownload?file=" & Picture_ID__c , "Picture")
Lets check how this function work. first part is the address of the picture that i stored in documents area, to grab url specific to your environment just go to Documents Tab file location and click view image and copy the url from address bar. To make it dynamic i used a Picture_ID field as a place where Image id is to be stored then appended with the URL using concatenating operator(&) and at last the Text("Picture") that will act as a hover text.
At this point i check and found full size image in page layout that make no sense of making link if original image shown at first place.
So i changed formula field look like
IMAGE( "https://c.ap1.content.force.com/servlet/servlet.FileDownload?file=" & Picture_ID__c , "Picture", 25,25)
I added last optional arguments of IMAGE() formula height and width.
This part of formula will only show image now we need to make it hyperlink so i changed formula as below
HYPERLINK("/servlet/servlet.FileDownload?file=" & Picture_ID__c, IMAGE( "https://c.ap1.content.force.com/servlet/servlet.FileDownload?file=" & Picture_ID__c , "Picture", 25,25))
In this HYPERLINK function first part can be the same link that we provided in IMAGE function and second part is the Image that we want to make as a link. so whenever we click on image the original size image will be shown in new window.
No comments:
Post a Comment