My drupal site was not in root directory of the server. Icons of this module didn't show.

Changed code on menu_icons.module and now it works ok

Diff from GIT:

@@ -516,11 +516,11 @@ function menu_icons_css_generate() {
       if ($absolute) {
         $image_url = file_create_url($image_path);
       }
       else {
         $wrapper = file_stream_wrapper_get_instance_by_scheme(file_uri_scheme($image_path));
-        $image_url = '/' . $wrapper->getDirectoryPath() . '/' . file_uri_target($image_path);
+        $image_url = $GLOBALS['base_path'] . $wrapper->getDirectoryPath() . '/' . file_uri_target($image_path);
       }
 
       $size = $pos == 'right' || $pos == 'left' ? $info['width'] : $info['height'];
       // Support private filesystem
       $css .= theme('menu_icons_css_item', array('mlid' => $item->mlid, 'path' => $image_url, 'size' => $size, 'height' => $info['height'], 'pos' => $pos, 'source' => $source_uri));
CommentFileSizeAuthor
#2 1960802-relative-base-path.patch607 bytesDave Reid
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Volker23’s picture

Thanks , this worked for me....

Dave Reid’s picture

Status: Patch (to be ported) » Needs review
FileSize
607 bytes

Patch attached for 7.x-3.x.

rooby’s picture

Status: Needs review » Reviewed & tested by the community

This fixes the problem.

rooby’s picture

Issue summary: View changes

Spelling

nerdoc’s picture

I can confirm that Dave Reids patch in comment #2 fixes the issue.

rcodina’s picture

Issue summary: View changes

Path in comment #2 also works for me. Thanks!

RIMAD’s picture

#2 works for me too. Thanx a lot!

Leonid92’s picture

Sorry my bad English. I in file menu_icons_css_item.tpl Replace background-image: url(<?php print $path ?>); on background-image: url(../<?php print $path ?>);.
In File menu_icons.module string 520 Delete and string 521 replace $image_url = '/' . $wrapper->getDirectoryPath() . '/' . file_uri_target($image_path); on $image_url = '/' . file_uri_target($image_path);

Anonymous’s picture

Hi Leonid92,
Your changes worked for me!!! At last!
I have drupal running on a subdirectory of my website and the path to the images was always wrong until I tried what you suggested.

Sorry my bad English. I in file menu_icons_css_item.tpl Replace........

7drupel7’s picture

I think many of us appreciate the patch in comment #2. Can someone commit that one ?

luisasasi’s picture

Path in comment #2 also works for me. Thanks!