function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
REstapp123REstapp123 

Documents to Image Synchronization -- help!!

Hi, I'm creating a Salesforce application for a group project in a course I'm currently in and I'm so close to completing it but I can't figure out a few things! The final portion of our project is something we wanted to put the extra effort in: allowing users to upload images and displaying those uploads in a related list on a detail page. So far so good. The problem is that I can't seem to get the IMG() function to work but I think it may be a coding issue.

 

Firstly, I have a Visualforce page that allows the User to browse for an image and upload it into their hidden Documents Tab. Note: I am developing in Eclipse. The controller class takes the URL of the new Document and stores into a URL field of a custom object:

 

//all required field entries

myDocument.isPublic = true;

 

insert myDocument;
        
Gallery__c myGallery = new Gallery__c();
myGallery.Image__c = myDocument.Url;
insert myGallery;

 

In the custom object, the URL value is plugged into the following formula field:

 

 HYPERLINK( Image__c , IMAGE(Image__c, "Uploaded Image", 100, 75) )

 

When I test it all out, instead of getting a resized image that is anchored, I get a text link with the alt "Uploaded Image".

 

1. What URL does the Document.Url value return? Is it the full document url?

 

2. I know that 'Externally Available Image' must be activated. Eclipse didn't list any fields similar to isExternallyAvailable so I assumed isPublic is the API equivalent. Are they not the same thing?

 

3.  Are image displays within another formula function allowed?

 

Thanks!

Message Edited by REstapp123 on 10-14-2009 01:52 AM
Best Answer chosen by Admin (Salesforce Developers) 
REstapp123REstapp123

Never mind! I figured out what I was doing wrong. So simple! Tsk tsk.

 

I thought the Document.URL value was automatically generated by Salesforce but nope. As a solution, I used the FileServer prefix:

 

/servlet/servlet.FileDownload?file=

 

I stored that into a String and concatenated the Document Id value into the Document's Url field. Easy fix!