You need to sign in to do that
Don't have an account?
Displaying a photo that acts as a link to another website
Hi Guys
I have a custom object that has a photo of the person in each record.
I want to display them in a datatable.. or maybe usng outputlink as follows:
Name Birthplace Photo
I can get this to work using the code shown below but the photos are huge and I cannot resize them.. also i cannot get them to act as a hyperlink to the new website...
You can see 2 other attempts below whaich are commented out where I tried to display the image in other ways..
If I use <apex:image it just shows the icon type outline of an image but it is sized nicely
If I use <apex:outputLink it just leaves a blank space where the photo should be..
am beginning to loose my mind because of this :)
Can anyone help?
j.themuss
<apex:dataTable id="soldierlist" value="{!Soldiers}" var="indsoldier" align="center" rules="rows" rowClasses="even,odd" bgcolor="FFFFFF" border="1px" cellpadding="5" cellspacing="5%">
<apex:column headerValue="Soldier">
<apex:outputText value="{!indsoldier.name}"/>
</apex:column>
<apex:column headerValue="Birthplace">
<apex:outputText value="{!indsoldier.Birthplace__c}"/>
</apex:column>
<apex:column headerValue="Photo">
<apex:outputField value="{!indsoldier.Soldier_Photo__c}" />
<!--apex:image id="SoldierPhoto" value="{!indsoldier.Soldier_Photo__c}" width="50" height="50"/ -->
<!--apex:outputLink type="image" value="{!indsoldier.Soldier_Photo__c}">
</apex:outputLink-->
</apex:column>
</apex:dataTable>
Tested this in my org beforehand, so it should work for you.
Hi SFDCFOX..
thanks for the help..
That improved things a little.. but it still does not show the actual photo..
In the visualforce deve env it shows a graphic icon...
I am wondering is the issue the way I am storing the photo...
I have a custom field on the soldier object called photo. It is an RTF Text field and I add the images via the Add Image button during record edit.
Is this the right way to store photos? Could this be the source of my issues?
If you visit the page itself it does not display anything at all..
The link value comes from another custom field in the soldiers object called {!indsoldier.Australian_War_Memorial_Link__c}
This link works when I click on it... but no photo is displayed...
<apex:column headerValue="Photo">
<apex:outputLink value="{!indsoldier.Australian_War_Memorial_Link__c}">
<apex:image url="{!indsoldier.Soldier_Photo__c}"/>
</apex:outputLink>
</apex:column>
Now in visualforce when I hover my mouse over the graphic icon I can see that the link is correct for that particular soldier.
But also no photo.. and on the force.com page itself nothing at all..
See what I mean at http://the1200.the1200sb.cs5.force.com/shland1200
Any other ideas?
j.themuss
Looking at the source, the image tags have no URL. Either the Sites user doesn't have access to the field, or there's nothing in that field. You'll need to do some debugging here, but the page's code from your sample appears to be correct now.