Forum Moderators: coopster
Now what I am trying to is add script so no matter what image url I put into the small image 1,2,3,4 field it shows the image at 100x100 pixels. Now I found the area in the code for the images(or atleast I think I did.
$simage1 = $sSQL3['pSmall1'];
$simage2 = $sSQL3['pSmall2'];
$simage3 = $sSQL3['pSmall3'];
$simage4 = $sSQL3['pSmall4'];
$limage1 = $sSQL3['pLarge1'];
$limage2 = $sSQL3['pLarge2'];
$limage3 = $sSQL3['pLarge3'];
$limage4 = $sSQL3['pLarge4'];
Now the simage 1 through 4 I want to auto display at 100x100. I have tried numerous combos to get this to work but to no avail and I am only getting parse errors on the line I try to change.
I have tried the following:
$simage1 = $sSQL3['pSmall1'] "width="100" height="100"";
$simage1 = $sSQL3['pSmall1']; "width="100" height="100""
$simage1 = $sSQL3['pSmall1 "width="100" height="100""'];
$simage1 = $sSQL3['pSmall1'];"width="100" height="100""
$simage1 = $sSQL3['pSmall1']"width="100" height="100"";
$simage1 = $sSQL3['pSmall1'"width="100" height="100""];
$simage1 = $sSQL3['pSmall1'];
None of this seems to work. To be honest I have no idea what I am doing. Any suggestions would be helpful
Oh and here is the rest of the code after it...I don't know if you need it:
if(($simage1<=0) && ($simage2<=0) && ($simage3<=0) && ($simage4<=0)){
print "<a href=\"javascript:popImage('$limage1','Image')\"><img src='$simage1' border='0'> </a> <a href=\"javascript:popImage('$limage2','Image')\"><img src='$simage2' border='0'> </a> <br><a href=\"javascript:popImage('$limage3','Image')\"><img src='$simage3' border='0'> </a> <a href=\"javascript:popImage('$limage4','Image')\"><img src='$simage4' border='0'> </a> ";}
else if(($simage1<=0) && ($simage2<=0) && ($simage3<=0) && ($simage4>=1)){
print "<a href=\"javascript:popImage('$limage1','Image')\"><img src='$simage1' border='0'> </a> <a href=\"javascript:popImage('$limage2','Image')\"><img src='$simage2' border='0'> </a> <br> <a href=\"javascript:popImage('$limage3','Image')\"><img src='$simage3' border='0'> </a> ";}
else if(($simage1<=0) && ($simage2<=0) && ($simage3>=1) && ($simage4>=1)){
print "<a href=\"javascript:popImage('$limage1','Image')\"><img src='$simage1' border='0'> </a> <a href=\"javascript:popImage('$limage2','Image')\"><img src='$simage2' border='0'> </a> ";}
else if(($simage1<=0) && ($simage2>=1) && ($simage3>=1) && ($simage4>=1)){
print "<a href=\"javascript:popImage('$limage1','Image')\"><img src='$simage1' border='0'> </a> ";}
else if(($simage1>=1) && ($simage2>=1) && ($simage3>=1) && ($simage4>=1)){
print " ";}
}
?>
$simage1 = $sSQL3['pSmall1'];
$simage2 = $sSQL3['pSmall2'];
$simage3 = $sSQL3['pSmall3'];
$simage4 = $sSQL3['pSmall4'];$limage1 = $sSQL3['pLarge1'];
$limage2 = $sSQL3['pLarge2'];
$limage3 = $sSQL3['pLarge3'];
$limage4 = $sSQL3['pLarge4'];
The variables set here will be used in an <image> tag.
Now look for thi skind of line where those variables are used to resize the image.
<image src="" width="" height="">
You might be better off resizing the images and not force them later to have a different height and width.
What about the bottom half.. I have been messing around with that:
"<a href=\"javascript:popImage('$limage1','Image')\"><img src='$simage1' border='0'> </a>
I have been trying to add this kind of information but to no avail
<img src='$simage1' border='0'>
I have tried this:
<img src='$simage1' alt="" width="100" height="100" border='0'>
that gave parse error
<img src='$simage1' alt='' width='100' height='100' border='0'>
This did not give me a parse error but did not resize the thumbnail automatically
Mark
HEIGHT='100' WIDTH='100'
to all of the bottom if's in order to get it to work. I was just doing it to the first one.
I do have one more question I have this at the top of my product detail page on every page. I don't know if I deleted something by accident or not. Tell me what you guys think.
Warning: session_start(): Cannot send session cache limiter - headers already sent (output started at /home/content/t/i/g/tiger5226/html/proddetail.php:1) in /home/content/t/i/g/tiger5226/html/proddetail.php on line 41
now line 41 looks like this:
</script>
<?php
session_cache_limiter('none');
session_start();
ob_start();
Line 41 is: session_start();
This is whats before it
<script>
// Set the horizontal and vertical position for the popup
PositionX = 100;
PositionY = 100;
// Set these value approximately 20 pixels greater than the
// size of the largest image to be used (needed for Netscape)
defaultWidth = 500;
defaultHeight = 500;
// Set autoclose true to have the window close automatically
// Set autoclose false to allow multiple popup windows
var AutoClose = false;
// Do not edit below this line...
// ================================
if (parseInt(navigator.appVersion.charAt(0))>=4){
var isNN=(navigator.appName=="Netscape")?1:0;
var isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}
var optNN='scrollbars=no,width='+defaultWidth+',height='+defaultHeight+',left='+PositionX+',top='+PositionY;
var optIE='scrollbars=no,width=150,height=100,left='+PositionX+',top='+PositionY;
function popImage(imageURL,imageTitle){
if (isNN){imgWin=window.open('about:blank','',optNN);}
if (isIE){imgWin=window.open('about:blank','',optIE);}
with (imgWin.document){
writeln('<html><head><title>Loading...</title><style>body{margin:0px;}</style>');writeln('<sc'+'ript>');
writeln('var isNN,isIE;');writeln('if (parseInt(navigator.appVersion.charAt(0))>=4){');
writeln('isNN=(navigator.appName=="Netscape")?1:0;');writeln('isIE=(navigator.appName.indexOf("Microsoft")!=-1)?1:0;}');
writeln('function reSizeToImage(){');writeln('if (isIE){');writeln('window.resizeTo(100,100);');
writeln('width=100-(document.body.clientWidth-document.images[0].width);');
writeln('height=100-(document.body.clientHeight-document.images[0].height);');
writeln('window.resizeTo(width,height);}');writeln('if (isNN){');
writeln('window.innerWidth=document.images["George"].width;');writeln('window.innerHeight=document.images["George"].height;}}');
writeln('function doTitle(){document.title="'+imageTitle+'";}');writeln('</sc'+'ript>');
if (!AutoClose) writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()">')
else writeln('</head><body bgcolor=FFFFFF scroll="no" onload="reSizeToImage();doTitle();self.focus()" onblur="self.close()">');
writeln('<img name="Product" src='+imageURL+' style="display:block"></body></html>');
close();
}}
</script>
<?php
session_cache_limiter('none');
session_start();
ob_start();