Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

easy pop up image size question


jpmad4it

Recommended Posts

hello

 

when i click on the product images to enlarge them, i wish to have the pop up box automatically enlarge around the full size of the photo its displaying - at the moment the pop up box is small, and to view the full image i have to use the mouse to resize the box - is it possible to do this automatically?

 

plus i dont want the box to be resizable - how is that done?

 

thanks in advance

 

Jp

Link to comment
Share on other sites

im sure i managed to do this but i cant remember how i did it :-(

 

Yeah, I'm having the same problem. I just searched through the forums and coldn't find anyone else with the same issue though. The "Click to Enlarge" link seems to cut about the bottom 1/4 inch off each picture. Surely there must be a fix for this...?

Link to comment
Share on other sites

  • 1 month later...
  • 2 weeks later...

has anybody got an answer to this issue? the pop-up image as the result of "click to enlarge" doesn't seem to work properly! the bottom part hides underneath!

 

any help?

Did you try? Did you fail? No matter! Try again. Fail again! But fail better!

Link to comment
Share on other sites

has anybody got an answer to this issue? the pop-up image as the result of "click to enlarge" doesn't seem to work properly! the bottom part hides underneath!

 

any help?

 

Your best bet would be to look on some Javascript forums/pages, more related to that than osCommerce.

Link to comment
Share on other sites

I did some javascript research as Mike suggested. I learned a few things...for one, the default size in the script needs to be bigger by about 20px than the largest image you plan to use. I believe you can change this default height/width in the shop/product_image.php file around line 29. I tried changing it without much luck but I didn't experiment long.

 

However, something I did that DID work was in the shop/popup_image.php file.

I found this code

 

<script language="javascript"><!--
var i=0;
function resize() {
 if (navigator.appName == 'Netscape') i=40;
 if (document.images[0]) window.resizeTo(document.images[0].width +30, document.images[0].height+60-i);
 self.focus();
}
//--></script>

 

Apparently the + numbers next to width/height have to do with how much padding is around your image in the popup. I don't really get why height has that "-i" as it looks like it might be reducing that number. I took it out and so far it hasn't caused any problems. I also increased the numbers a bit...I was only having a problem with the height.

 

Anyhow...I've only experimented with a few images and it works fine now and isn't cutting off any image edges. As always, back up the file first...its the only way I feel comfortable playing. I mean, I'm totally winging here (then again, I'm winging my whole way through osc). ;)

 

Lauren

Link to comment
Share on other sites

Here's a great solution by Peter Todorov that I've used for several web sites. It can be tweaked for use in OSC pretty easily. You have three elements:

1. The javascript

2. The HTML that links to your popup

3. The popup itself.

 

Here's the code, enjoy.

The Javascript:
<script language="Javascript">
  function PopupPic(sPicURL) {
    window.open( "popup.html?"+sPicURL, "",
    "resizable=1,HEIGHT=200,WIDTH=200");
  }
  </script>

The HTML on the page:
<a href="javascript:PopupPic(\'Image1.gif\')">Image 1</a><br>
  
The popup.html:
<HTML>
<HEAD>
<TITLE>Fit the Pic Script</TITLE>
<script language='javascript'>
var arrTemp=self.location.href.split("?");
var picUrl = (arrTemp.length>0)?arrTemp[1]:"";
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">
<script language='javascript'>
document.write( "<img src='" + picUrl + "' border=0>" );
</script>
</BODY>
</HTML>

Link to comment
Share on other sites

  • 2 months later...

its so much easier than that - go to popup_image and mess around with the values in this function:

 

function resize() {

if (navigator.appName == 'Netscape' || 'Internet Explorer') i=40;

if (document.images[0]) window.resizeTo(document.images[0].width +50, document.images[0].height+100);

self.focus();

}

 

 

ps you need to add the internet explorer bit into the function

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...