Documentation > CMS Template API Library > Input > ShowAcquireImage(String,String,ShowAcquireParams,String,String,String,Boolean)

ShowAcquireImage

Displays a "select" and "clear" button that is used to upload an image into the current template. Note: You no longer need to use an upload.aspx, if you want to create a thumbnail. Use the AddAdditionalImage method on the ShowAcquireParams object to define the thumbnails that you want to create. See the examples below.

public System.Void ShowAcquireImage(String,String,ShowAcquireParams,String,String,String,Boolean)

Parameters

NameDescriptionType
label The label of the field when displayed. System.String
fieldName The field name where the uploaded filename will be stored. System.String
acquireParams Customization parameters. An empty "Extensions" parameter will default to: "png gif jpeg jpg" CrownPeak.CMSAPI.ShowAcquireParams
helpMessage Optional: help message System.String
displaySizeName Optional: If you are passing a list of thumbnails to create in the ShowAcquireParams, use it to specify which one to display. System.String
popupMessage Optional: The popup help message. System.String
alwaysSend Optional: If true, the value of the field will always be sent from the frontend to the backend regardless of whether its state has changed. System.Boolean

Code Example

C#

Sample:

             	               
                             <%  
                                 // Upload or select an image and create images of the specified sizes.  
                                 // The 300 size will be displayed on the input form
                                 ShowAcquireParams parameters = new ShowAcquireParams();  
                                 parameters.DefaultFolder ="/Assets/images";
                                 // Create a thumbnail that is no more than 300 pixels on each side (aspect ratio is preserved)
                                 parameters.AddAdditionalImage("my_photo_300", 300, 300);
                                 // Create a thumbnail that is no more than 100 pixels on each side (aspect ratio is preserved)
                                 parameters.AddAdditionalImage("my_photo_100", 100, 100, 100);    
                                 // The 300 pixel thumbnail will be displayed when they edit this input form.
                                 Input.ShowAcquireImage("Attachment", "attach", parameters, displaySizeName: "my_photo_300") ;
                              %>
                              <% 
                                 // Upload only
                                 // The 300 size will be displayed on the input form
                                 ShowAcquireParams parameters = new ShowAcquireParams();  
                                 parameters.DefaultFolder ="/Assets/images";
                                 parameters.ShowBrowse = false; // CMS browser is hidden
                                 parameters.AddAdditionalImage("my_photo_300", 300, 300);
                                 parameters.AddAdditionalImage("my_photo_100", 100, 100, 100);    
                                 Input.ShowAcquireImage("Attachment", "attach", parameters, displaySizeName: "my_photo_300") ;
                              %>
            
                
             	

Connect with Crownpeak