How to display one image or a group of images using the SharinPix Album component? (Developer-Orient

This article demonstrates how to:

The SharinPix abilities includes the parameter, filter_group , that takes as value the Public IDs of the images to be displayed.

Below is a code snippet demonstrating how this parameter is added to the SharinPix abilities:

{
	abilities:
    	{
        	'<<public id of album>>':{
            	Access:{
                	image_list:true
                }
			}
        },
    filter_group: '<<Public ID of image>>' // Filter one image
	filter_group: [<<Public ID of image>>, <<Public ID of image>>, <<Public ID of image>>] //Filter multiple images
    Id: '<<public id of album>>'
}
circle-exclamation
circle-check

Therefore, to display one or more images on a SharinPix Album, we will proceed as follows:

  1. Retrieve the required public image ID(s)

  2. Implement an Apex class consisting of the SharinPix Album's parameters (including the filter_group parameter)

  3. Implement a Visualforce page that will display the album

Retrieve the required Image Public ID(s)

To display an image or a group of images in a SharinPix Album, you first need to retrieve the image ID(s). There are two ways of retrieving an image ID:

Using SharinPix Image Sync to retrieve an image ID

Image Sync is a SharinPix functionality allowing users to extract useful data from an image when it is uploaded to a record's SharinPix Album.

Using Image sync, a SharinPix Image record is created whenever an image is uploaded to an album. The SharinPix Image record stores image details such as ID, format or dimensions. Therefore, to retrieve the ID of an image using image sync, simply open its corresponding SharinPix Image entry, and copy the Image Public ID from there.

circle-check

Using the SharinPix Admin Dashboard to retrieve an Image ID

To retrieve an Image ID via the SharinPix Admin Dashboard, follow the steps below:

  • Using the App Launcher, search and open SharinPix Settings

  • Once the SharinPix Settings tab is opened, click on the button Go to administration dashboard. This step will direct you to the admin dashboard

  • Next, on the admin dashboard, click on the Albums option on the top menu bar

  • Search and open the album containing the desired image(s)

  • Once the album is opened, search for the required image and click on the available link to open it

  • Once the image is opened, you can access its Image Public ID from the URL.

Below is an example of such URL:

https://app.sharinpix.com/admin/images/2dd58ca9-9893-451b-b64e-0c969fc57248

The Public Image ID is found at the end of the URL, that is 2dd58ca9-9893-451b-b64e-0c969fc57248 in this case.

  • You can now copy the image ID

Now that you know how to retrieve image IDs, we can go ahead with the actual implementation.

Display a specific image on a SharinPix Album

To display a specific image on a SharinPix Album follow the steps below:

  • Retrieve the Image Public ID of the desired image

  • Implement an Apex class with the required SharinPix abilities including the filter_group parameter. You can use the code snippet below for this implementation. Here the Image Public ID is 1d03b314-c3f7-4a2f-8912-cb7f24933e8c. You should replace this value with your Image Public ID

  • Implement a Visualforce page that will display the SharinPix Album with the chosen image. You can do so by using the code snippet below:

You can now test your implementation by adding the Visualforce page on your page record (add to the Account record page if you used the above code snippets).

The results will be as follows:

Display a group of specified images on a SharinPix Album

This implementation is similar to that used in the previous section. The only difference here is that we will use a list of Image Public IDs instead of a single ID. To do so follow the steps below:

  • Retrieve the Image Public IDs of the desired images

  • Implement an Apex class with the required SharinPix abilities, including the filter_group parameter, using the code snippet below:

As you can see here, we used a list of String to hold the desired Image Public IDs.

  • Next, implement a Visualforce page using the code snippet below:

You are all done!

Now, go ahead and add the Visualforce page on the Account record page to test your new implementation.

The results will be as follows:

As you can see in the above example, only the two specified images (that is, images with public IDs added as value to the filter_group parameter in the above code snippet) are being displayed.

Last updated

Was this helpful?