0

Trying to set image name from attribute , For dynamic load. Is there any other way ?

<aura:component access="global" implements="lightning:availableForFlowScreens">
   <aura:attribute name="imageName" type="String" access="global" default="{!$Resource.abd}"/>
   <div class="slds-p-top_medium slds-clearfix">
      <div class="slds-float_left">
         <!-- Display company logo --> 
         <h2>
          <img src="{!$Resource+v.imageName}"/>   
          </h2>
      </div>
      <div class="slds-float_right" style="position:relative;">
         <aura:if isTrue="{!v.screenHelpText ne null}">
            <!-- If the screen has help text, display an info icon in the header.
                 On hover, display the screen's help text -->
            <lightning:helptext content="{!v.screenHelpText}" />
         </aura:if>
      </div>
   </div>
</aura:component>
-1

Yes, You can achieve it through Lightning Component 'Controller':

  1. Collect all the images, make a zip folder.
  2. Collect all the images, make a zip folder.
  3. Upload it to the static resource.
  4. Use Images in dynamic reference.

Follow the below controller code :

({
    profileUrl: function(component) {
        var profileUrl1 = $A.get('$Resource.yourGraphics') + '/images/avatar1.jpg';
        var profileUrl2 = $A.get('$Resource.yourGraphics') + '/images/avatar2.jpg';
        var profileUrl3 = $A.get('$Resource.yourGraphics') + '/images/avatar3.jpg';

        alert("Profile URL 1: " + profUrl1);
        alert("Profile URL 2: " + profUrl2);
        alert("Profile URL 3: " + profUrl3);
    }
})
| improve this answer | |
  • This Scenario and solution I am already aware about I do want to add a path rather then being name itself. Although looks according to SFDC standard Docs its not possible – AvengerSF Apr 6 at 2:51

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.