I'm trying to get a function working to re size any image using a custom module and helper class. For the record I'm running this on a local XAMPP server.
If I pass a image url and a destination url using '/' all works fine. However I need to implement this with DS for future proofing. The following is an example line of code I'm using. with the DS instead of '/'
$newPath = Mage::getBaseDir(Mage_Core_Model_Store::URL_TYPE_MEDIA) . DS . "resized" . DS . $fileName;
This returns (without the http or localhost at the start because stackoverflow doesn't allow that even in code) "/test/media/resized\catalog\category\testcat.jpg"
How do I make it so that DS correctly returns forward slashes?
directory
separator. You should use it to buildpath to file
. You shouldn't use it to build imageURL
.Mage::getBaseDir
- notgetSkinUrl
- he is looking to get the path to image - not the URL for the imagehttp://localhost/test/media/resized\catalog\category\testcat.jpg
but he had problems to write that on stackexchange??? But getBaseDir does not add a http:// ...