Closed (fixed)
Project:
Background Images
Version:
7.x-1.0-beta3
Component:
Miscellaneous
Priority:
Normal
Category:
Feature request
Assigned:
Unassigned
Reporter:
Created:
23 Jan 2012 at 23:38 UTC
Updated:
7 Jul 2012 at 04:24 UTC
I was wondering if you plan to make this great module more flexible... I'm sure many would like to have an option to add different selectors for different node types.
Thank you.
Comments
Comment #1
drclaw commentedI think at this point, for version 1 of the module, I probably wouldn't add this functionality. But I'm definitely up for discussion for version 2!
I'm actually interested in how people are using this module. I created it in the first place because we got a few requests in a row to have some kind of interface to change the background images of the site. For example, one company wanted to change the background image based on the season, or if they had a promotion going on that month. How would you see yourself using the feature you requested if it was available? What would be the use case?
Thanks!
Comment #2
gge commentedAll I wanted was an easy way to manipulate background images in header, and your module is great for that. After playing with it for a while, I realized that would be interesting to have an option to insert a background image (like a watermark), in the content region of all the articles as well.
Comment #3
4fs commentedJust to add my 2 cents. I have a e-commerce website I am building and what we have is different clothing ranges each representing different styles or feelings(dark, edgy, clean etc). So I had the idea of changing the bg image for each section in a fairly subtle way. I am going to try this module, but what I am requiring is that based on taxonomy terms (ubercart) the background would change for those pages based on selection. Not sure if that is even possible right now.
Comment #4
drclaw commentedMaybe try using context? You should be able to set up a taxonomy term as a condition and then use Background image as the reaction.
(Note: For D7 You will need the Background Image Context module enabled. For D6 the background image context reaction should already be available)
Comment #5
drclaw commentedJust postponing this for now. Will revisit when 2.0 is in the works.
Comment #6
jay.lee.bio commentedI'm actually surprised nobody mentioned this before, but I need what Twitter allows its users to do in their profile pages where they can customize the background. Here is an example of a profile of my friend's company:
http://twitter.com/redfootsocial
Here is another example of a profile of another friend who's a badass musician:
http://reverbnation.com/prettyboybeats
And remember a long time ago when Myspace allowed its users to customize their profile background (and unfortunately fucked it all up)? Same concept.
All I need the module for is to allow users to customize the background of their profile pages so that any visitor can see it. I need it for my music startup at http://discography.by and will happily provide all feedback necessary to make sure it does exactly what I think it should've been able to do since day one, hehe. I'll also give you credit and heavily promote this module in a future blog post at http://jayl.ee as well.
Thanks in advance for your consideration. :D
Comment #7
jay.lee.bio commentedhttp://drupal.org/node/1533258
Maybe you and cableman0408 can collaborate?
Comment #8
jay.lee.bio commentedComment #9
drclaw commentedI have plans to do something like this in the 2.0 version. However, that might not be for a little while...
One thing you could do is add an image field to the user entity and then add just a bit of custom code to your theme to get this working. First, add the image field to the user entity at Configuration > People > Account Settings. Then, if you don't have a user-profile.tpl.php file already, copy the one from modules/user into your theme and add this to your template.php file:
The image will be applied using the default css settings on the bg_image configuration page. You can also override the css:
Hope that helps!
Comment #10
jay.lee.bio commentedThanks for the reply drclaw. I'll try it out after I get your module working first lol. For whatever reason, I can easily get cableman0408's Dynamic Background module working (and his version 2.0 ALMOST does exactly what I want), but I don't know why I can't get yours to work. I'll let you know the results after giving it some more effort.
Comment #11
jay.lee.bio commentedOk I give up drclaw. Can you or anyone please help me at least get this module working? I tried everything at least three times, so I must be missing something simple.
What I'm confused about is, what do you mean when you say I need to call bg_image_add_background_image_from_node($nid, $css_settings)? Do you mean create a simple custom module with just the function in it, or put it in the template.php file in my theme folder? I tried both and still no luck.
I'm also confused with the concept of uploading an image to say an article and using that as a background image. Why would anyone wanna do that (won't it show the image twice in the page?!?), or am I totally misunderstanding this as well?
Comment #12
drclaw commentedHi @Jay Lee
The function bg_image_add_background_image_from_node($nid, $css_settings) applies an image to the page using an image from the node of the $nid passed in to it. You can call the function from a number of places (e.g. a preprocessor in template.php in your theme, or a hook_init in a custom module etc.). Before this works however, you have to have a content type with an image field, and configure bg_image to use it on the bg_image configuration page. So, suppose you had a content type called bg_image with an image field called field_bg_image. You would go to the configuration page for the module and choose those items from the Node Type and Node Field settings in the Node Settings fieldset. When you call bg_image_add_background_image_from_node, it loads the image path from the node, and applies the image as a background using css.
The idea here is that you can use nodes to manage your images. You could then use one of the additional modules (bg_image_context or bg_image_ui) to actually apply those images to pages. As I mentioned above, you could also apply background images on a page using your own custom module, or in your theme in template.php (in a preprocessor function for example).
In your case, however, if you just want a user to be able to apply a background image to their own profile page, you can add an image field to the user entity (admin/config/people/accounts/fields) and apply it to their profile page in the profile page preprocessor in your template.php file in your theme. That's what I described in comment #9. NOTE: To hide the image from being displayed as a field on the profile page, you can just set it to hidden on the "Display Fields" page (admin/config/people/accounts/display). I'll admit it's a work around since I don't have this functionality out of the box, but it works. I know because I tested it when you brought it up.
I know it's a bit confusing. The whole idea of using a content type as the image interface is a bit weird. Dynamic Background uses a custom upload field and it makes the whole process simpler. I chose to use nodes because I wanted to be able to use views to list the background images that were active on the site so a client could easily change them. In that specific case, the background images were placed using contexts and I didn't want to send the client to the context administration page just to change the background image.
Hopefully this clears things up for you! =)
Comment #13
jay.lee.bio commentedOk drclaw, I finally got it working (at least partially) using beta 2. So while I test it out some more (because it has its own set of issues, such as random background images showing up that I think you're already aware of), you might want to look into why beta 3 doesn't work. Or am I the only one having this problem?
Comment #14
jay.lee.bio commentedOk drclaw, I did some more testing. Here's what I found so far:
1) I can only get beta 2 to work. I tried beta 1 & 3, and both of them don't work for me no matter what I do.
2) Since beta 2 shows random background images but I only need the module for user profiles, I left the configuration page to whatever the default values were. Then I followed your directions at #9 and finally got the user profiles to show background images, yay! But the problem here is that the background image of user one (and ONLY user one) shows up in every other user profile no matter what I do.
a) If I delete that background image, then nothing shows up even if I log in as a different user and set up a different background image for that user.
b) So then I tried giving a random user administrator status, and still nothing shows up until I set a background image for user one.
3) Beta 2 initially gave me a warning regarding entities. I'm gonna do some more testing on this to see if I can duplicate the warning, and will report back what I find.
So while I do that, can you think of an update on the workaround you provided at #9 to get 2) to work properly? Then that'll get you that much closer to version 2.0. :D
Comment #15
drclaw commentedI just tested my #9 on a fresh install of Drupal 7 with bg_image 7.x-3.0-beta3. It works. I don't know why it's not working for you, but I'll need to know more about what you're doing and what kind of error messages you're seeing in order to help you. I did a little more testing with the user profile pages. I did notice a small error in comment #9 regarding the user id. Here's what I did to get the bg image working on a fresh install of Drupal 7 (maybe this will help?):
- Installed Drupal 7.12
- Left the active theme as "Bartik"
- Downloaded bg_image and enabled the bg_image module
- Set up the following settings on the bg_image configuration page (admin/config/content/background-image)
-- Selector: #main-wrapper
-- Color: transparent
-- Horizontal Alignment: left
-- Vertical Alignment: top
-- Background Attachment: scroll
-- Background Repeat: none
-- Important: True
- Added an image field to the user profile (and set it to hidden on the Display Fields screen)
- Created two users and uploaded different images to each one
- Added the following code to the Bartik theme's template.php:
Then I went to the user's pages and reloaded, and the images were there.
I hope this helps... or something... =)
Comment #16
jay.lee.bio commentedWow drclaw, you are amazing. IT WORKS (on beta 2)!!! :D
I'll get back to you tomorrow on why the hell beta 1 & 3 don't work for me as well as the error message that I'm trying to duplicate. I owe you that much to say the very least for all you've done, in such a timely manner as well.
For now, I just wanna enjoy the moment. I'm mesmerized. Wow, you are a genius. Thank you so much. :-)
Comment #17
jay.lee.bio commentedHi drclaw, I'm reporting back briefly for now that your instructions WORK (after a couple minor hiccups)! :D
I'll come back with more details, but give me a few days (since I want to get back to you on everything else at once). But I just wanted to let you know that beta 3 indeed works!!! :-)
Comment #18
drclaw commentedNice. Thanks Jay!
Comment #19
jay.lee.bio commentedCrap, crap, crap. Sorry drclaw, I forgot about you. What happened was, I got frustrated at trying to reproduce the error message, decided to give it another shot a few days later, and never got around to it. Then I realized I was supposed to have gotten back to you when I was posting a reply to this guy lol:
http://drupal.org/node/1533258
Ok so here is my final report regarding #16:
1) The reason why beta 1 & 3 initially didn't work for me as well as my front-end designer was completely due to "operator error" lol. Yes, two dumb people not following directions correctly. The source of the problem was "YOUR_FIELD_NAME". Yeah, you wrote it in capital letters and we STILL didn't get it. Of course, eventually I was able to see what we did wrong and it's now working perfectly.
2) The error that I can't reproduce no matter what I do is the following (I only copy & pasted what I thought was the important part to save & Google later):
"Warning: array_flip() [function.array-flip]: Can only flip STRING and INTEGER values! in DrupalDefaultEntityController->"
And I remember it was in the entity.inc file. I think you can safely ignore this error message until someone else also gets it and can show the steps required to reproduce it. It might also not have anything to do with Background Images and might just be related to Entity API. Who knows.
Anyway, thanks again for all your hard work. I'll let you know when I launch my site, because it's starting to look REALLY good. :-)
P.S. Will you be having a link showing sites that use Background Images? It's one of the modules that saved my life and I want my site to be proudly included in that link after it launches should you choose to have one. For example, something like this: http://drupal.org/project/ddblock (under the picture, where it says "For sites using ddblock see: Sites using ddblock")
Comment #20
drclaw commentedHey Jay,
Thanks for getting back to me. No worries about the delay. I'm glad your site's coming together!
I'm not sure if I will do a "Sites using Background Images" on the project page. There's no way for people visiting a site to see how it actually works because it's mostly a presentational module.
Thanks again!
drclaw
Comment #21
drclaw commentedClosing this for now. 7.x-1.x is sort of on feature freeze. 7.x-2.x is gonna be even better and more flexible though!