/home/you/magento/media/myimage.jpg
Now, http://www.you.com points to magento/
But we all know that absolute links like
<img src="http://www.you.com/media/myimage.jpg">
are naughty
so you really want to say is
<img src="<?php echo Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB);?>media/myimage.jpg">
And I just gave it away.
So here's the lowdown for an html file in magento.
Mage::getBaseUrl is the magento root folder.
Mage::getSkinUrl and Mage::getImageUrl should also work, to the skin and mediaimages folders respectively.
(note the "should" - I havent tried them yet!)
Note this only works in html files, for the scripty type files you would use something else, like
$this->getSkinUrl()
Or thats what I'm guessing.
Thanks, you saved my day :)
ReplyDelete