dvdsndr
dvdsndr

Reputation: 11

Magento Media URL stripping all forward slashes

on a dev box we have noticed in some text attributes the media encased urls eg:

<img src="{{media url="wysiwyg/diagram/bigpool.jpg"}}"/>

are being displayed on the front end as

<img src="{{media url="wysiwyg diagram bigpool.jpg"}}"/>

and obviously breaking the image links. Playing around with {{skin url & {{ base url yields the same results. Any URLs outside of this are working fine.

To clarify it is saving correctly in the database (with slashes) but rendering in the browser without which is breaking the image.

I've also hardcoded the url without the {{media url=""}} and it will render fine.

Has anyone run into this problem before or any ideas on what would be causing this? Google and SE are not being to helpful!

The dev box is running NGINX, hhvm & Magento CE 1.9.2

Cheers.

Upvotes: 1

Views: 704

Answers (1)

SimBeez
SimBeez

Reputation: 175

You can use below code

<?php 
$string='<img src="{{media url="wysiwyg diagram bigpool.jpg"}}"/>';
echo $this->helper('cms')->getBlockTemplateProcessor()->filter($string)
?>

This will display proper image as you want.

Upvotes: 1

Related Questions