+ Reply to Thread
Results 1 to 6 of 6

Thread: Attached Image Popup fit to Image Specs

  1. #1
    Member epic1 is on a distinguished road
    Join Date
    Feb 2005
    Posts
    33

    Attached Image Popup fit to Image Specs

    I've done over 20 searches, still cannot find how to do this.

    I have my attachments open in a new window via target="_blank". That's all good and done.

    I need the popup window to fit to the image's size. I have both scripts I need to use to do this, I just don't know how to go about putting them together in the correct manner via the template manager.

    Code snippet 1 within Showthread template header:

    Code:
    <script language="javascript" type="text/javascript"> 
    function PopupPic(sPicURL) { 
    	newWin=window.open( sPicURL, 'newWin', 
    	'resizable=1,HEIGHT=200,WIDTH=200'); 
    	newWin.focus(); 
    } 
    </script>
    Code snippet 2...no clue where to put this:

    Code:
    <html> 
    <head> 
    <title></title> 
    <script language="javascript" type="text/javascript"> 
    var NS = (navigator.appName=="Netscape")?true:false; 
    function FitPic() { 
    	iWidth = (NS)?window.innerWidth:document.body.clientWidth; 
    	iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
    	iWidth = document.images[0].width - iWidth; 
    	iHeight = document.images[0].height - iHeight; 
    	window.resizeBy(iWidth, iHeight); 
    	self.focus(); 
    }; 
    </script> 
    </head> 
    <body bgcolor="#000000" onload="FitPic();" topmargin="0" 
    marginheight="0" leftmargin="0" marginwidth="0"> 
    <img src="$image&amp;id=$id" border="0" alt="" /> 
    </body> 
    </html>
    It does open the attachment in a new 200x200 window, but it does not resize since I'm stumped on where to put the second code tidbit.

    Any help would be greatly appreciated!

  2. #2
    vBulletin Team Jake Bunce has a spectacular aura about Jake Bunce has a spectacular aura about Jake Bunce's Avatar
    Join Date
    Dec 2000
    Location
    Land of the In-N-Out Burger
    Age
    28
    Posts
    46,521
    You have code within your page head, so you should add that code to the headinclude template.

    I don't know what to do with the rest of that code since I am not familiar with it.

  3. #3
    Member epic1 is on a distinguished road
    Join Date
    Feb 2005
    Posts
    33
    Are any other options available to achieve this auto-resize window for the attached image in the popup?

    I know vBGarage can do this, as this is using the popup code mentioned above, however it ties in a seperate template for the new window (what Code snippet 2 refers to).

    Is there a way to call upon a new template that passes over the image as a string of some sort?

    I'd be greatful to any suggestions as I hate having unnecessary space filling the surrounding image attachments in their new windows.

  4. #4
    vBulletin Team Jake Bunce has a spectacular aura about Jake Bunce has a spectacular aura about Jake Bunce's Avatar
    Join Date
    Dec 2000
    Location
    Land of the In-N-Out Burger
    Age
    28
    Posts
    46,521
    I don't know of any way to do this.

  5. #5
    Senior Member WetWired is on a distinguished road WetWired's Avatar
    Join Date
    Jul 2002
    Posts
    314
    Normally, attached pictures are shown without a page (there is no HTML in the popup window). You need to either have the popup JS open an about:blank, then write a page with your special resize code in it (which I have no idea how to do, but know that it can be donw), or add a new PHP page to create the page with your script and the propper image.

  6. #6
    New Member keithxtreme has disabled reputation
    Join Date
    Jan 2006
    Posts
    4
    Quote Originally Posted by epic1
    I've done over 20 searches, still cannot find how to do this.

    I have my attachments open in a new window via target="_blank". That's all good and done.

    I need the popup window to fit to the image's size. I have both scripts I need to use to do this, I just don't know how to go about putting them together in the correct manner via the template manager.

    Code snippet 1 within Showthread template header:

    Code:
    <script language="javascript" type="text/javascript"> 
    function PopupPic(sPicURL) { 
        newWin=window.open( sPicURL, 'newWin', 
        'resizable=1,HEIGHT=200,WIDTH=200'); 
        newWin.focus(); 
    } 
    </script>
    Code snippet 2...no clue where to put this:

    Code:
    <html> 
    <head> 
    <title></title> 
    <script language="javascript" type="text/javascript"> 
    var NS = (navigator.appName=="Netscape")?true:false; 
    function FitPic() { 
        iWidth = (NS)?window.innerWidth:document.body.clientWidth; 
        iHeight = (NS)?window.innerHeight:document.body.clientHeight; 
        iWidth = document.images[0].width - iWidth; 
        iHeight = document.images[0].height - iHeight; 
        window.resizeBy(iWidth, iHeight); 
        self.focus(); 
    }; 
    </script> 
    </head> 
    <body bgcolor="#000000" onload="FitPic();" topmargin="0" 
    marginheight="0" leftmargin="0" marginwidth="0"> 
    <img src="$image&amp;id=$id" border="0" alt="" /> 
    </body> 
    </html>
    It does open the attachment in a new 200x200 window, but it does not resize since I'm stumped on where to put the second code tidbit.

    Any help would be greatly appreciated!
    So you are putting that code in the SHOWTHREAD template? Are you then calling the JS with sPicURL from the postbit_attachment thumb template by replaing 'new window' with sPicURL?

    At least having a window open that is not full screen would be better than nothing....

+ Reply to Thread

Similar Threads

  1. Include attached image in quote
    By Andy in forum vBulletin Suggestions and Feedback
    Replies: 4
    Last Post: Sat 16th Apr '05, 4:16pm
  2. Displaying previously attached image in another post
    By extremeskins in forum vBulletin 3.0 How Do I and Troubleshooting Forum
    Replies: 6
    Last Post: Sun 20th Mar '05, 7:20pm
  3. Attached image massive
    By okc in forum vBulletin 3.0 How Do I and Troubleshooting Forum
    Replies: 2
    Last Post: Mon 10th Jan '05, 5:21am
  4. Attached Image problem **HELP**
    By Gez in forum vBulletin 2 'How Do I' and Troubleshooting
    Replies: 10
    Last Post: Sat 16th Aug '03, 6:32pm
  5. Attached image is too large
    By osluk in forum vBulletin 2 'How Do I' and Troubleshooting
    Replies: 1
    Last Post: Thu 6th Feb '03, 9:50pm

Bookmarks

Posting Permissions

Posting Permissions
  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts