Magento Question

Hello
When I try to give media url in catagory-> description like this.

<img src="{{media url="/HD53_1.jpg"}}" alt="" />

so image doesn’t display at front end because when i see html code of this image src in WYSIWYG editor then it give wrong path.

so plz give me correct way to give media url

3 thoughts on “Magento Question”

  1. Click the WYSIWYG editor button, then click on the image button (looks like a tree). Then click the icon to the right of the Image URL field (looks like a folder). Use the Media Uploader to save your new image to the server, then select on the newly-uploaded image and click Insert Image. Change back to the Insert Image popup and click Insert. Submit and Save.

  2. How about these :

    $mainImage = Mage::getBaseDir('media') . DS . 'test' . DS . 'image.jpg';
    // will show http://example.com/media/test/image.jpg
    

    or

    Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_MEDIA);
    // will show http://example.com/media/
    

    In CMS pages should be :

    {{store direct_url=media}}
    // this will produce http://www.example.com/media  
    

    Outside of the CMS pages :

    {{store direct_url=media/store/cms/brands/brand_logo.gif}}
    // this will produce  http://www.example.com/media/store/cms/brands/brand_logo.gif
    

  3. use Mage::getBaseDir(‘media’) this function for get media folder url path and ‘DS’ for separator of folder.
    like Mage::getBaseDir(‘media’) . DS . ‘your folder’;

Leave a Reply

Your email address will not be published. Required fields are marked *