Skip to content

Instantly share code, notes, and snippets.

@LeeSaferite
Created January 16, 2014 20:31
Show Gist options
  • Save LeeSaferite/8462876 to your computer and use it in GitHub Desktop.
Save LeeSaferite/8462876 to your computer and use it in GitHub Desktop.
Mage_Cms_Helper_Wysiwyg_Images has a bug when you have the /media directory symlinked in to the deployment location (At least as of EE 1.13.1)
<?php
/**
* Return URL based on current selected directory or root directory for startup
*
* @return string
*/
public function getCurrentUrl()
{
if (!$this->_currentUrl) {
$mediaDir = Mage::getConfig()->getOptions()->getMediaDir();
$path = str_replace(realpath($mediaDir), '', $this->getCurrentPath());
$path = trim($path, DS);
$this->_currentUrl = Mage::app()->getStore($this->_storeId)->getBaseUrl('media') . $this->convertPathToUrl($path) . '/';
}
return $this->_currentUrl;
}
<?php
/**
* Return URL based on current selected directory or root directory for startup
*
* @return string
*/
public function getCurrentUrl()
{
if (!$this->_currentUrl) {
$path = str_replace(Mage::getConfig()->getOptions()->getMediaDir(), '', $this->getCurrentPath());
$path = trim($path, DS);
$this->_currentUrl = Mage::app()->getStore($this->_storeId)->getBaseUrl('media') .
$this->convertPathToUrl($path) . '/';
}
return $this->_currentUrl;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment