Page 1 of 1
Theme option: Selecting an image from the media database
Posted: Sun Oct 11, 2009 4:43 pm
by yellowled
A long time ago, in a galaxy far, far away, a young Jedi knight -- I believe it was Judebert -- implemented a great feature in our little light sabre called s9y: template designers are now able to give users a theme option giving them the possibility to select an image from the media database. I think this was originally done to pave the way for the customizable header image in Bulletproof.
Now, if users actually select an image, the theme option generates a preview of said image, which is basically awesome, but displayed tiled. Which looks, well, confusing, to say the least. It would actually be very simple to fix that (by adding an [inline] style -- background-repeat: no-repeat; -- to the preview div for the image), but unfortunately, I have no idea where to even begin looking for the appropriate piece of code.
So, Jude (or anyone), where the hell is that thing in the s9y code?
YL
Re: Theme option: Selecting an image from the media database
Posted: Mon Oct 12, 2009 9:52 am
by garvinhicking
Hi!
./include/functions_plugins_admin.inc.php
Code: Select all
function change_preview(id)
{
var text_box = document.getElementById('serendipity[template][' + id + ']');
var image_box = document.getElementById(id + '_preview');
var filename = text_box.value;
image_box.style.backgroundImage = 'url(' + filename + ')';
}
Re: Theme option: Selecting an image from the media database
Posted: Mon Oct 12, 2009 12:59 pm
by yellowled
garvinhicking wrote:./include/functions_plugins_admin.inc.php
Thanks. Fix committed to trunk.
YL
Re: Theme option: Selecting an image from the media database
Posted: Mon Oct 12, 2009 3:44 pm
by Don Chambers
I didn't check your revision... Did you do did background-repeat: no-repeat for all, or only those where the background image was, in fact, set to no-repeat? Should probably set exactly the same background properties that can be set (bottom, top, center, etc).
Re: Theme option: Selecting an image from the media database
Posted: Mon Oct 12, 2009 3:57 pm
by yellowled
Don Chambers wrote:I didn't check your revision...
You never do.
Don Chambers wrote:Did you do did background-repeat: no-repeat for all, or only those where the background image was, in fact, set to no-repeat? Should probably set exactly the same background properties that can be set (bottom, top, center, etc).
I can't even access the other variable holding the background-repeat from where I'm doing this (as far as I can see). Remember, this is
not in BP, it's in the s9y core. Besides, it might as well be used in other templates which don't even offer a background-repeat for the image in question. So the general function for this (in the core) should not use background-repeat at all.
Besides, I don't think a "preview" of a tiled image makes sense here. The area for displaying it is rather small, it's not in the context where the image will be used ... I really don't think it is of much use. However,
if it's possible at all to add that to BP, we could at least test it. But I sure as hell have no idea whatsoever how to implement that
YL
Re: Theme option: Selecting an image from the media database
Posted: Mon Oct 12, 2009 4:14 pm
by Don Chambers
I check revisions.... once in a while!
Yes, background position and repeat are handled by BP's index.tpl... thought you were making this change not just to the core, but within the context of BP. Come to think of it, not sure how that would work in the back end.
Never mind. Carry on. Nothing to see here.
