When I add an image with the WYSIWYG-editor, the image path is to long. I get the following path:
<img src="media url="home/magento/static/media/wysiwyg/people.png"" alt="" />
Instead of:
<img src="media url=wysiwyg/people.png"" alt="" />
When I import the image URL, I get in the WYSIWYG pop-up the following image URL:
The image URL is as follow: https://server.magento.local/index.php/smladmin/cms_wysiwyg/directive/___directive/e3ttZWRpYSB1cmw9ImhvbWUvc2FuaWRpcmVjdC9zdGF0aWMvbWVkaWEvd3lzaXd5Zy9sb2dvLXBpbi5wbmcifX0,/key/acc4e19a8864aa88801f17ea0d3d8b3e/
I think the problem has something to do with the Symlinks? Because it is only on our server, not in our local environment.
How could i solve this issue?
Thanks
I found the answer in another post: How can I relocate my magento store's media directory?
--
Can add as symbol links,
but you will get some problem with WYSIWYG editor in admin panel :)
Need following:
edit /app/code/core/Mage/Cms/Helper/Wysiwyg/Images.php
function getCurrentUrl()
$path = str_replace(Mage::getConfig()->getOptions()->getMediaDir(), '', $this->getCurrentPath());
change to
$path = str_replace(realpath(Mage::getConfig()->getOptions()->getMediaDir()), '', $this->getCurrentPath());
Related
I've just added a simple code (<img src="images/2.jpg"/>) in my WordPress website. But it's not working. Check it out
Please help me to solve the issue.
Try add leading slash to your image path to start at the root directory instead of your current directory where your code is located:
<img src="/images/2.jpg"/>
most likely the path is incorrect. images is not immediate directory to your current page directory.
usually in wordpress images are in wp-content/uploads/2017/05/%some_image.jpg%
you are using <img src="path"/> you can solve this issue by adding the url of the image like C:\Users\Hitesh Kumar\Desktop\xyz.jpg.
but i know that you are using wordpress so you can add the image by its url like <img src="www.site_name/image.jpg"/>
hope it will help
Need to add this code (<?php echo get_template_directory_uri();?>) to make it dynamic.
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.
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.
I have a form which successfully upload a picture to a folder and save its full path to database.But when I want to display the image nothing is shown.
This is one of the uploaded image's path in database:
/home/webuser/public_html/traincms/upload/koala.jpg
this image saved in a folder of server.what should I do to display the images?
Thanks for your help.
You should use HTTP path of image, if you are using codeigniter then try this way
<?php echo img("traincms/upload/koala.jpg"); ?>
OR
<img src="<?php echo base_url("traincms/upload/koala.jpg")?>" />
Hope your code will store in public_html directory
Finally I found the solution.My upload path was
$path=dirname($_SERVER['SCRIPT_FILENAME']).'/upload/';
I saved this path to database.When I want to display the image on browser it did not display it with this path.I uploaded the image with above path but I saved this path to database:
$image_path=base_url().'/upload/'.$_FILES['pic']['name'];
now I can upload and display the images successfully.
I'm running Wordpress on WAMP right now and I'm trying to figure out how to correctly reference an image that i'm using in my header for all my pages.
If I write this:
<img src="wp-content/themes/my-theme/images/SSBlogoALPHA.png">
the logo shows up on the WP homepage, but not on any subsequent pages.
If I write
<img src="../wp-content/themes/my-theme/images/SSBlogoALPHA.png">
the logo shows up on all subsequent pages, but not the homepage.
to be honest I don't know what the "../" does or where my root folder is supposed to be when writing a directory path but these are the ways that i've seen other people do this. Any ideas? Thanks!
you can get the images by following way
<img src="<?php bloginfo('template_directory'); ?>/images/SSBlogoALPHA.png" alt=""/>
i have used the following code but it didnt work
/images/ncr.jpg" alt="ncr.com" />
I have pur my image in the images folder of twentyeleven child theme
can anyone help
Thanks in advance..
The theme folder URL can be found at /wp-content/themes/twentyeleven.
Your header file is actually included at the root level, and as such relative paths won't work.
WordPress provides a function to access your current theme's directory, and as a result you should use this code:
<img src="<?php echo get_template_directory_uri(); ?>/images/ncr.jpg" alt='ncr.com'>