+ Start a Discussion
Sherwin liSherwin li 

Failed to create a simple Visualforce page that displays an image

Create a Visualforce page without the standard Salesforce header and display an image using the Visualforce image component.
The page must be named 'DisplayImage'.
It must NOT display the standard Salesforce header.
It must use a Visualforce apex:image component to display this image - https://developer.salesforce.com/files/salesforce-developer-network-logo.png

<apex:page showHeader="false" title='DisplayImage'> 
    <apex:pageBlock >
        <apex:image url="https://developer.salesforce.com/files/salesforce-developer-network-logo.png"/>
    </apex:pageBlock> 
</apex:page>

Challenge Not yet complete... here's what's wrong: 
The 'DisplayImage' page was not found.
Best Answer chosen by Sherwin li
Dileep KumarDileep Kumar

Hi Sherwin,

<apex:page showHeader="false" title="DisplayImage" sidebar="false"> 
    <apex:form>
        <table>
            <tr>
                <td width="1000px" height="600px;" align="center">
                    <apex:image url="https://developer.salesforce.com/files/salesforce-developer-network-logo.png" />
                </td>
           </tr>
        </table>
    </apex:form>
</apex:page>

User-added image

This is correct page.

Please mark this as a best answer.

Thanks,

Dileep

All Answers

Dileep KumarDileep Kumar

Hi Sherwin,

<apex:page showHeader="false" title="DisplayImage" sidebar="false"> 
    <apex:form>
        <table>
            <tr>
                <td width="1000px" height="600px;" align="center">
                    <apex:image url="https://developer.salesforce.com/files/salesforce-developer-network-logo.png" />
                </td>
           </tr>
        </table>
    </apex:form>
</apex:page>

User-added image

This is correct page.

Please mark this as a best answer.

Thanks,

Dileep

This was selected as the best answer
Sherwin liSherwin li
Hi Dileep,

     Still no luck. The 'DisplayImage' page was not found.
Dileep KumarDileep Kumar

Hi Sherwin,

whatever name you will write inside Name box that will save as a page name.

e.g If you will write 'DisplayImage' in place of 'a_b' in below image then your page name will 'DisplayImage'

User-added image

 

Do you want to save page name as like title name ??

<apex:page showHeader="false" title="DisplayImage" sidebar="false"> 
    <apex:form>
        <table>
            <tr>
                <td width="1000px" height="600px;" align="center">
                    <apex:image url="https://developer.salesforce.com/files/salesforce-developer-network-logo.png" />
                </td>
           </tr>
        </table>
    </apex:form>
</apex:page>

Title is a attribute of <apex:page/> tag you can not save page name as like title.Title tag is used for the purpose of tab name.

 

please let me know about further cofusion.

Thanks,

Dileep

 

Dileep KumarDileep Kumar

Hi Sherwin,

If you want to create this page using developer console. it will work.

In both way it will work.

1.> Go to setup -> Develop ->Visualforce Page

2>Open Developer console ->select File -> select New  -> click on Visualforce page 

Give the page name and save.now again go to File -> select Open ->click visualforce page

Two show the page in browser please click on 'PreView' Button.

Thanks,

Dileep

Samir Sayyad 18Samir Sayyad 18

<apex:page showHeader="false" >
    <apex:image url="https://developer.salesforce.com/files/salesforce-developer-network-logo.png" />
</apex:page>

Above code snippet is enough..>.

aman batra 3aman batra 3
use below code :

<apex:page showHeader="False">
<apex:pageBlock>
<apex:pageblocksection>
  <apex:image url="E:\Users\monika.w\Desktop\salesforce-developer-network-logo.png"/>
  </apex:pageblocksection>
  </apex:pageBlock>
</apex:page>

 
Wasim Maroofi 8Wasim Maroofi 8
I am confused as to why the guide on visualforce uses VALUE=" " instead of URL=" "???

apex:image usage from Visualforce Developer Guide.

I wasted hours on this before finding this post.