You need to sign in to do that
Don't have an account?
simson
cant Show contact images in customer portal
Is it possible to show the images on the customer portal?
The requirement is to show portal users a photograph of their Company contact person.
In the Company contact's attachment section i have attached a image as an attachment.
Once the portal user clicks on the link to show the companys contact person a visual force opens up to show the contact photo.
The visual force code is as follows:
<apex:page controller="ViewContactImages" showHeader="false"> Showing the Image with Id {!mainImage} <apex:image url="{!URLFOR($Action.Attachment.Download, mainImage)}"/> </apex:page>
The controller is as follows:
public class ViewContactImages{ public Id mainImage; public Id getMainImage(){ system.debug('getting the mainImageId =='+mainImage); return mainImage; } public void setMainImage(Id imageId){ this.mainImage = imageId; } public ViewContactImages(){ mainImage = [select Id from Attachment where ParentId = :ApexPages.currentPage().getParameters().get('conId')].Id; } }
When i get into the customer portal and get to the visual page that shud show the image i cannot see the image.
Any heads up appreciated.
Thanks'
Simson
Hey
Are you sure that your object is viewable for that customer portal profile? You might also want to check field level security for that object in the CP profile.
Wes
Thanks Wes for your reply.
Yes it is the "Contact" Object and it has read,create and edit permissions on it.
Any other thing that i need to check?
Thanks
Simson
Other things to check are:
Wes
1. Yes,The debug message gives me the Id that is needed.
2. The view source on the page gives the following :
Hmmm, trickier and trickier.
If you browse to the attachment within salesforce you'll arrive at a screen with a link that says 'Click here to view this file'. Does clicking that show the image properly? Look at the url, does it match the URL inside of the <img> tag?
Wes
hi Wes,
Thks again for your quick response.
I need to show up the image when the page loads.i do not want to link which says "Click here to view this file".
When i get on to the page i see the page without the image.
Yeah I didn't mean link to this page, just see if you can see the image from there. If you can't see the image from that link then the image might be damaged, or possibly something has gone wrong on the Salesforce side. Can you upload another image in a different format and then try?
As this image is based on the contact i tried to add another image for a different contact and checked of the image was visible for a different contact,but the image did not show up for the other contact too.I even tried to change the image file format from jpg to gif and check if it works but that dint work either :(
I think I'm out of ideas then. I've done the same in one of my Org i.e.
Found a PNG image that worked in my documents.
Added this as an attachment to a contact.
Clicked on the the attachment in the contact's related list.
Clicked on 'Click here to view this file'.
I then see the image. If you're admin and have full rights I can't think of anything else to check. Sorry.
Wes
oh . OK. When i go to the screen which u have published and click on the 'Click here to view this file'.i can see the image too.I am the admin and have rights on the system.its only on the visual page that i cannot see the image.'
Simson
i can see the image when i click on the screen which u have shown below..its only when i get intp the visual page i cannot see the image.i am the admin and have acess rights.
Simson
Okay so check the URL when you click 'Click here to view this file'. Is it the same as the URL within the <img> tag?
For me it's: /servlet/servlet.FileDownload?file=00PS0000000J9PB in the first case.
Start by viewing the page as a logged in admin and compare the two URLs.
Wes
Clicking on "Click here to view this file" gives the following url - /servlet/servlet.FileDownload?file=00PR0000000HkYy.
The url within the image tag is /servlet/servlet.FileDownload?file={!mainImage} where the ={!mainImage} is 00PR0000000HkYyMAK.
i even tried to do a substring(0,15) on the image id so that i have only 15 digits in the image Id.
And yes i compared the 2 urls by logging in as admin.
Regards
Simson