Support for Drupal 7 is ending on 5 January 2025—it’s time to migrate to Drupal 10! Learn about the many benefits of Drupal 10 and find migration tools in our resource center.
I've installed the background image kit feature, but every time I go to the theme config page and click on the background image drop down box, there are no images listed (see attachment image).
There are definitely images in the correct directory. The images bundled with the theme are there, and can be viewed at the URL where they reside.
Any thoughts?
Nick
My drupal install info - OS/DB etc also attached FYI.
Comment | File | Size | Author |
---|---|---|---|
#6 | patch.patch | 49.84 KB | -osiris- |
#5 | background-imagekit-patch.patch | 2.55 KB | -osiris- |
#2 | sooperBGerror.JPG | 36.04 KB | nicktr |
drupal status.JPG | 79.36 KB | nicktr | |
bgimagekit-bug.JPG | 27.67 KB | nicktr |
Comments
Comment #1
zandros CreditAttribution: zandros commentedThis is what I have done to fix this:
I opened the background-imagekit-theme-settings.inc in the folder: sooper-background-imagekit
and I edited the following lines:
line 13:
foreach (file_scan_directory($theme_path .'images/backgrounds', '.jpg') as $file) {
(the reg exp that includes all types of images is not correct, so as you can see I have just changed it to .jpg)
line 14:
$bg_images[$file->name] = $file->name;
(filename now stands for path and not name)
and line 15:
$bg_image_suffix .= '<p>'. $file->name .'</p> <div class="demo-background" style="background:url(/'. $file->filename .');"></div>';
uri has been replaced with filename and filename with name.
Comment #2
nicktr CreditAttribution: nicktr commentedThanks for your fix.
I've made the changes and the configurator now displays the available backgrounds in the dropdown box, but doesn't actually show the images below the dropdown box.
See attachment for screen shot.
I've figured out why:
Using element inspector in Google Chrome I can see the URL for the images is incomplete.
My site is in a subdirectoy of root, and this subdirectory is not being used to reference the images. I guess this has something to do with lines 14 and 15?
I.e.
It should be:
site.com/subdir/sites/all/themes/tundra/sooper_tundra/images/backgrounds/img.jpg
but instead it's just
site.com/sites/all/themes/tundra/sooper_tundra/images/backgrounds/img.jpg
If I hard code the name of the subdirectory into the background-imagekit-theme-settings.inc at line 15 (in the background:url)
$bg_image_suffix .= '<p>'. $file->name .'</p> <div class="demo-background" style="background:url(/subdir/'. $file->filename .');"></div>';
It shows me the images correctly in the configurator.
However, it does not show the image in the background. Perhaps this is also a path issue.
Any help much appreciated!!
Comment #3
zandros CreditAttribution: zandros commentedAs I see on my working environment, after the fix that I have implemented, the image that is set to the background is something like that:
background-image: url(/themes/tundra/sooper_tundra/images/backgrounds/white-grunge_concrete_plaster);
It gets the file's name (from the select list) and looks it in the path /themes/tundra/sooper_tundra/images/backgrounds/.
Since you know how to use the element inspector, I would suggest to you to inspect the element body after you have selected a background image in the "tundra theme configuration" and see if it actually sets a relevant path or something else.
Comment #4
nicktr CreditAttribution: nicktr commentedI've done as you said and can see that no background image is set at all for the body, after saving in the configurator.
I guess this is linked to the issue 'settings do not save' http://drupal.org/node/966108
Comment #5
-osiris- CreditAttribution: -osiris- commentedHi.
Let me suggest this patch, solving the Regex issues, thus scanning for png, gif and jpg as well as fixing the subdir issue, where drupal installations below webroot level would point the background image to the wrong path.
Also merged in is suggestion of comment #1.
Comment #6
-osiris- CreditAttribution: -osiris- commentedThe changes made required some more rewrite of your code, nothing drastical, but you often had the path coded in a way, that content would not get included if drupal resided in subdirectories. Fixed that, so with this patch the imagekit should be fully functionable.
Comment #7
JurriaanRoelofs CreditAttribution: JurriaanRoelofs commentedThanks for your work osiris. My working copy of the theme is not the same as the CVS version so I'm going to have to apply the patch manually, what is it exactly that you have done? I think the main problem is that $base_url needs to be used so that urls correctly point to Drupal installations in subdirectories right?
But whats going on with the liveprevies javascript, it seems to change nothing in the background image url?
I'm still not sure about what problems play here exactly but the part of my code that looks dangerous is using ../../../$theme_path or even just $theme_path, instead I shall replace these instances with with $abs_theme_path as this will always point to the drupal installation path.
Comment #8
JurriaanRoelofs CreditAttribution: JurriaanRoelofs commentedalso, I believe your patch refers to code from the Drupal 7 version is that right? because this issue is listed as Drupal 6
Comment #9
JurriaanRoelofs CreditAttribution: JurriaanRoelofs commentedPlease update your Tundra installations to version Beta 2. I got a bunch of cvs errors before I could tag the beta so also please let me know if you spot a problem with this, I really dont get along well with CVS myself..
I put this important message on the project page, please make sure you update the features along with the Tundra theme itself:
"Make sure you download the zip files for the right version of the Tundra theme, If you update your Tundra theme to a newer version, you must also download the new zips from here. If you hover the zip links you can see they point to a specific version, this version should always match the version of the Tundra theme."
Comment #10
-osiris- CreditAttribution: -osiris- commentedI hope you had a nice holiday, peach.
Firstly, my patch referres to drupal 6.x, precicely 6.20, if that is of value.
Second, where do I get the Beta 2, drupal.org still only lists Beta 1?
Third: Problems with the includes are caused by drupal being installed beneath webroot. To solve this, exact paths my be more useful.
That means, they have to be adressed in
features/sooper-background-imagekit/background-imagekit-theme-settings-css.inc.
You should in fact point the bg-image to
Btw, I just noticed what a mess my SVN made, but I do not know how tu really just handle the diff in versions.
Fourth: The other thing I noticed was, that when using any of your plugins, theme_get_setting() causes some troubles. I think this can be fixed by using $settings['setting_name'] instead as often as possible.
Fifth: The regex scanning for the background images colud look like this:
Excuse any minor mistakes, I'm just growing used to collaborating on code projects. I'm grateful for any further advice.
greetings,
osiris
Comment #11
JurriaanRoelofs CreditAttribution: JurriaanRoelofs commentedthanks, I did have a great time.
I actually forgot to create a release on the project page itself, I've just done that.
regarding the paths, the $abs_theme_patch should point to the drupal installation even if its in a subdirectory, at least thats what I intended it to be used for. The difference of adding the base url shouldn't be relevant, the difference in paths would be
http://google.com/subdirectory/folder/file.png
and without base url:
/subdirectory/folder/file.png
I any case both these urls point to the right file absolutely, at least on my computers, if there is someone who can clarify this that would be great.
Comment #12
JurriaanRoelofs CreditAttribution: JurriaanRoelofs commented