Download & Extend

Images not showing when language prefix is set

Project:SexyBookmarks
Version:6.x-1.1
Component:Code
Category:bug report
Priority:normal
Assigned:Unassigned
Status:closed (fixed)

Issue Summary

Hello

Like the titles says, there is a problem showing the images when having a multilingual site and using language prefix. If one of the following options "Path prefix only" or "Path prefix with language fallback" is set under /admin/settings/language/configure then the images won't load because the url to the images include the prefix of the language.

Instead of
http://www.domain.com/sites/all/modules/sexybookmarks/images/icons/bitacoras.png

where the images are located you get the following
http://www.domain.com/hr/sites/all/modules/sexybookmarks/images/icons/bitacoras.png

I've checked the sexybookmarks.css file which is created at
http://www.domain.com/sites/default/files/css/sexybookmarks.css and the language prefix is set here for the background-image:

I'm not a pro in coding, but is it possible that the problem here is because in sexybookmarks.module for the _sexybookmarks_add_css function drupal_get_path is used?

Here is my setting for the website
- 2 languages, croatian and hungarian (hr and hu), croatian is default
- english language is disabled
- Path prefix with language fallback ( using this option because "Path prefix only" won't put the prefix for the default croatian language)

I hope this information helps to solve this little problem and the next release will include the fix for it.

Igor

Comments

#1

Version:6.x-1.x-dev» 6.x-1.1

The same issue for me. Very annoying bug.

#2

Well, there's a way to fix this problem but only temporary. When the css file is created, you change the URL path to the images manually by deleting the language prefix from the URL and save the file. Like is said, this is working only for a short time, because when you clear the cache (clear css cache as well) you're faced with the same problem.

#3

Assigned to:igor.klajo» Anonymous

Same issue here

#4

Same issue here

Thanks for support!

#5

Same issue here

On my site the button images do not load, but the module its self is loading. I have a blank strip at the bottom where the buttons should be and I can move a mouse over the strip and see the link but know graphics. I have an English - Chinese site and I'm using path prefix with language fall back (both languages have defined prefixes).

Thanks for your support.

#6

Status:active» needs review

I did the following change and it's working with me so far

in file "sexybookmarks.module" in each usage of drupal function "url" did the following

  1. add following line
    $url_options = array('language' => '');
  2. change following line
        $bookmarks[$key]['icon'] = isset($bookmarks[$key]['icon']) ? url($bookmarks[$key]['icon'])
          : url( drupal_get_path('module', 'sexybookmarks'). '/images/icons/' . $key . '.png', $url_options);

    to utilize the "$url_options"

Also anyone can just replace the "sexybookmarks.module" with the attached one as changes on it.

AttachmentSize
sexybookmarks.tar_.gz 2.6 KB

#7

also in attached file in #6 #787664: Images not showing when language prefix is set before the loop there is

$base_icon_path = drupal_get_path('module', 'sexybookmarks');

so in I used

    $bookmarks[$key]['icon'] = isset($bookmarks[$key]['icon']) ? url($bookmarks[$key]['icon'])
      : url( $base_icon_path. '/images/icons/' . $key . '.png', $url_options);

which it is should be a bit faster O_o.

#8

Subscribe. Extremely nice module for my one-language-only sites, though!

#9

You can fix this multi language problem (and another one with non valid html code in the links) without touching the module code, just by theming. See the german solution at

http://blog-das-oertchen.de/de/blog/2010/06/08/drupal-social-bookmarks-k...

Just as info: Copy the three bold marked files from the module/theme folder to the folder of your theme and do the changes in the copied files.

#10

@LeisureLarry Thanks for the link.

#11

I solved my problem with the help of post #6
Thanks

#12

Status:needs review» fixed

Should be fixed in 6.x-2.x.

#13

Status:fixed» closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

nobody click here