View Full Version : how to change backgorund color for attachment popup
psasse
03-05-2009, 08:17 AM
Is there a way to change the background color in the popup windows for attached images?
I think this would imply a html-page being displayed instead of just the plain image. But how do i change this?
Best regards,
Matthias
Lynne
03-05-2009, 02:42 PM
Find the template and then change it there. to find the template - vboptions > General Settings > Add Template Name in HTML Comments > set to Yes . Then go back to your page and view the source code and you will see the name of the template called around your part of the code. Sometimes the template is the one mentioned at the very top of the page source.
psasse
03-05-2009, 03:17 PM
Thank you, Lynne!
So i found this code in postbit_attachmentthumbnail, which seems to be the link used, when opening an attached image:
<a href="attachment.php?$session[sessionurl]attachmentid=$attachment[attachmentid]&d=$attachment[dateline]" rel="Lightbox_$post[postid]" id="attachment$attachment[attachmentid]"<if condition="$show['newwindow']"> target="_blank"</if>> thumbnail code removed</a>
So I guess I would have to make changes to attachment.php, in order to not only show the plain image, but a html-site with the image and the desired background color?
I don't know much about php, so can this be done in a few simlpe steps?
Lynne
03-05-2009, 03:23 PM
I thought you wanted to change the background of the actual pop-up? If so, click on the link to pop it up and the view the page source and find the template name there.
psasse
03-05-2009, 03:40 PM
I thought you wanted to change the background of the actual pop-up? If so, click on the link to pop it up and the view the page source and find the template name there.
Yes, but if I klick the thumbnail of an attached image, a popup window opens, showing the full-sized image. But it is not a html or php page, it's just the image as if you would use a direct link to a .jpg
Lynne
03-05-2009, 03:46 PM
Oh, I thought you meant the page where you do the attaching (the pop-up you get when you hit Manage Attachments). Are you using lightbox? I have no clue how to change that.
psasse
03-06-2009, 08:57 AM
I'm not using Lightbox because i need the images to open in a new window.
I'm running a site for phtographers, where many image attachments are made and viewed, and people would really appreciate seeing the pictures on a dark background.
As far as i understand (and i really don't understand much about php) i would have to modify the attachment.php in a way, that is does not only send the plain image, but an .html file with my desired background color.
EDIT:
I found a solution myself :)
It's based on a simple java script, which requires the user to have JS turned on, but that would be the same with lightbox anyway.
It requires the following changes to postbit_attachmentthumbnail:
At the beginning add:
<script type="text/javascript">
function showPic(it) {
var w = window.open("","","width="+screen.width+",height="+screen.height+",left=0,top=0,resizable=1,scrollbars=1,status=0,me nubar=0,top=0,left=0");
w.document.writeln("<body bgcolor='#333333'>");
w.document.writeln("<table width='100%' height='100%' border='0' cellpadding='0' cellspacing='0'><tr><td align='center' valign='middle'><img src='" + it + "'></td></tr>");
w.document.writeln("<\/body>");
w.document.close();
}
</script>
Of course you can change the bgcolor, window size etc. to anything you prefer.
And to the thumbnail-Link add:
onclick="showPic(this.href);return false"
right after the href="..."
Lynne
03-06-2009, 02:01 PM
Ah, good sleuthing! :up:
vBulletin® v3.8.12 by vBS, Copyright ©2000-2025, vBulletin Solutions Inc.