How many different ways to insert image in magento cms page?

  • i tried to insert image with two different ways like through CMS pages in that select page and in content use below code:

    <p><img src="{{skin url='images/media/404_callout1.jpg'}}" alt="" /></p>
    

    and another way is by click on the "insert image" button.

    Is there any other way for for insert image in CMS page?

  • Using the "Insert Image" button will add the images which are relative to the media wysiwyg directory

    img src="{{media url="wysiwyg/filename.jpg"}}" alt="" />
    

    You could also have images stored as the content of a static block and then call them into the cms page contact using either using

    {{block type="cms/block" block_id="staticblock_identifier"}}
    

    Or use the widget interface and select Widget Type "CMS Static Block" which will add blocks by id like

    {{widget type="cms/widget_block" template="cms/widget/static_block/default.phtml" block_id="10"}}
    

    If you'd like the image to appear just above or below the main content look at adding it through layout XML and adding a static block either for that page using the CMS page design tab or for every CMS page using the "cms_page" layout handle.

    If your image is stored as a static block and you'd like it before the main content add the following XML to your page or cms handle.

    <reference name="content">
        <block type="cms/block" before="-">
            <action method="setBlockId"><block_id>staticblock_identifier</block_id></action>
        </block> 
    </reference>
    

    If you'd like the block to come after the content enter

    after="-"
    

License under CC-BY-SA with attribution


Content dated before 7/24/2021 11:53 AM

Tags used