SharinPix DocumentationMain Documentation SharinPix features - Download imagesMultiple Image download (ZIP) - How to personalize the download filenames

Multiple Image download (ZIP) - How to personalize the download filenames

The screenshot below demonstrates the SharinPix Search component fetching and displaying all the images present on every Service Appointment records which are associated to the current Work Order object.

The SharinPix Search can be used to download selected images into a zip folder. You also have the possibility to define custom names to assign to the zip folder as well as define names of the individual image files inside the zip folder.

Note:

In order to use custom download filenames, you should ensure that the SharinPix Permission Set named, SharinPix Lightning Components, has been assigned to all users requiring this functionality.

Download Parameters

In any case, to be able to download images, you have to set the download parameter to true:

download: true.


To define the name of the zipped/unzipped folder, use the download_filename parameter. The value should be of type String, for example: download_filename: 'my_zip_filename'.


To define the individual names of the image files inside the zip folder, either of the 2 parameters below can be used:

  • download_filenames: The value should be of type String, for example: download_filenames: 'inside_the_zip-00001' . The names of the individual files will be in the following format:

 inside_the_zip-00001, inside_the_zip-00002, inside_the_zip-00003 and so on. 


  • download_custom_filename: This parameter allows us to download the image with a custom filename. The value of the custom filename should be stored in a Salesforce field on the SharinPixImage__c sObject. The Salesforce field API name should then be used as the value for the parameter download_custom_filename, for example: download_custom_filename: 'CustomFilename__c', where CustomFilename__c refers to the API name of the Salesforce field storing the value for the custom filename.

In a SharinPix Search context, the download parameters can be used as shown in the following code snippet.

params = new Map<String, Object> {
            'path' => '/search?search_bar=false&q=' + clientInstance.token(query),
            'download' => true,
            'download_filename' => 'my_zip_filename',
            'download_filenames' => 'inside_the_zip-00001'
         };

When using the above code snippet, the SharinPix Search Component will name the zipped folder as my_zip_filename while the names of the individual files will be in the format: inside_the_zip-00001, inside_the_zip-00002, inside_the_zip-00003 etc..

The following code snippet includes the usage of the download_custom_filename parameter in the SharinPix Search.

params = new Map<String, Object> {
            'path' => '/search?search_bar=false&q=' + clientInstance.token(query),
            'download' => true,
            'download_filename' => 'my_zip_filename',
            'download_custom_filename' => 'CustomFilename__c'
         };

Using the above code snippet, the SharinPix Search Component will name the zipped folder as my_zip_filename and use the value stored in the field labelled as CustomFilename__c to name the individual files.

Tips:

  • For more information about how to implement a personalized SharinPix Search, refer to the following article:

Using your personalized Search

  • SharinPix also has parameters such as custom labels, date or tags that can be used to display more details on the image thumbnails in the search. For more information on these parameters and how they are configured, refer to the following article:

Display Thumbnail Infos

Images are selected
Images are downloaded
Zipped Folder
Unzipped Folder
Individual Files inside unzipped Folder

Using Download Parameters in SharinPix Album

For SharinPix albums, the download_filename and download_filenames parameters can be defined using in album parameters of an Apex controller as demonstrated in the code snippet below:

Map<String, Object> params = new Map<String, Object> { 
            'download' => true,
            'download_filename' => 'sample_folder',
            'download_filenames' => 'inside_the_zip-00001',
            'abilities' =>  new Map<String, Object> { 
                'download' => true,
                albumId =>  new Map<String, Object> { 
                    'Access' =>  new Map<String, Object> { 
                        'see' => true,
                        'image_download' => true,
                        'image_list' => true,
                        'image_upload' => true,
                    }
                }
            },
            'Id' => albumId
        };

The download_custom_filename parameter on the other hand can be configured in 3 ways:

  1. Using the SharinPix Global Settings
  2. Using a SharinPix Permission record
  3. Using an Apex controller

The following code snippet includes the usage of the download_custom_filename parameter in the Apex controller.

Configuring the download_custom_filename parameter in the SharinPix Global Settings

The download_custom_filename parameter can be configured using the SharinPix Global Settings record by populating the Salesforce field on sObject SharinPixImage__c with custom image filename for zip download field in the Miscellaneous section as shown below:

To access the SharinPix Global Settings:

  • From App Launcher, search for SharinPix Settings
  • Once on the SharinPix Settings tab, click on the Go to administration dashboard button. This action will open the global settings
  • Next, from the global settings, click on the Settings option from the top menu bar
  • Then click on the Edit Organization button and scroll down to the Miscellaneous section to configure the download_custom_filename parameter as demonstrated in the above image

Configuring the download_custom_filename parameter using a SharinPix Permission record

The download_custom_filename can be configured using the SharinPix Permission record by populating the Salesforce field on sObject SharinPixImage__c with custom image filename for zip download field in the Miscellaneous section as shown below:

In the above example, the value stored in the field sharinpix__Filename__c (which refers to the filename in this case) is used to name the individual files.

Note:

When configuring the download_custom_filename via a SharinPix Permission record, you should ensure that the Download zip parameter is checked in order to allow the download feature on the album.

Configuring the download_custom_filename parameter using an Apex controller

For SharinPix albums, the download_filename and download_custom_filename parameters can be defined using in album parameters of an Apex controller as demonstrated in the code snippet below:

Map<String, Object> params = new Map<String, Object> { 
            'download' => true,
            'download_filename' => 'sample_folder',
            'download_custom_filename' => 'sharinpix__FileName__c'
            'abilities' =>  new Map<String, Object> { 
                'download' => true,
                albumId =>  new Map<String, Object> { 
                    'Access' =>  new Map<String, Object> { 
                        'see' => true,
                        'image_download' => true,
                        'image_list' => true,
                        'image_upload' => true,
                    }
                }
            },
            'Id' => albumId
        };

Tip:

SharinPix also provides more parameters such as custom labels, date or title that can be used on the image thumbnails to provide more information about the images. For more information about these parameters and how to configure them, refer to the following article:

Thumbnail View - Display infos

0 Comments

Add your comment

E-Mail me when someone replies to this comment