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
the_wolfthe_wolf 

Need Help!! <apex:image> don't have "align" parameter as tag html <img>

Hi all,

 

i have this tag, which should display an image (the id is stored in a custom field ):

 

<apex:image value="/servlet/servlet.FileDownload?file={!p.image_id__c}" width="113" height="86" align="left" />

 

I need, in my website, that the text is placed to the right of this picture, but the "align" parameter does not exist in tag <apex:image>.

 

How can i do?

 

Thanks in advance!! 

Message Edited by the_wolf on 02-03-2010 01:48 AM
Best Answer chosen by Admin (Salesforce Developers) 
BulentBulent

I would recommend using the following format

 

 

<img src="{!URLFOR($Action.Attachment.Download, !p.image_id__c)}" style="vertical-align:left" width="113" height="86">

 

 

All Answers

BulentBulent

I would recommend using the following format

 

 

<img src="{!URLFOR($Action.Attachment.Download, !p.image_id__c)}" style="vertical-align:left" width="113" height="86">

 

 

This was selected as the best answer
the_wolfthe_wolf

Bulent,

 

your code works fine !!

(with align="left" and not with style="vertical-align:left", and without " ! " before p.image_id__c)

 

I always used "/servlet/servlet.FileDownload?file=attachmentID" to display image attached to a record, but in this case only the URLFOR Action works correctly for the tag img.

 

In particular, when i want to see a list of attached images (through <apex:repeat> ) only the <apex:image> shows these with "/servlet/servlet.FileDownload?file=attachmentID".

 

What is the exact difference between these 2 links? 

 

Thanks again!! 

BulentBulent
It's best practice not to hard code urls in the page. URLFOR function has a special logic that understands the site context and generate the correct url so if your site has a path you don't have to worry abut hard coding it. URL for knows the site context and current site and generates the correct url both when the page is rendered within the salesforce and from the public site
Message Edited by Bulent on 02-04-2010 07:43 AM
vpmvpm
Hi,

Can u tell explain this? (!p.image_id__c)