Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

keeping image proportion. Which bright spark altered OSCom??


maz

Recommended Posts

Hi there

My thumbnails are being displayed out of proportion.

Previouly I used a contribution 'Keep Image Proportion' It worked great in earlier TEP Snaphots. But not in latest snapshot (jan15). Someone altered the OCommerce code i guess, and now i'm losst.

 

 

In the earleir snapshot this is what i did:

 

The only file to change was html_output.php

 

In html_output.php (function tep_image)

 

 

replace:

 

if ( ($width) && ($height) ) {

$image .= ' width="' . $width . '" height="' . $height . '"';

}

 

with:

 

if ( ($width) && ($height) ) {

$image_size = @getimagesize($src);

$ratio = $width / $image_size[0];

if ($image_size[1]*$ratio > $height) {

$ratio = $height / $image_size[1];

$width = $image_size[0] * $ratio;

} else {

$height = $image_size[1] * $ratio;

}

 

$image .= ' width="' . $width . '" height="' . $height . '"';

 

 

But in the latest TEP Snapshot the line of code to change has altered to:

 

if ( (!$width) && ($height) ) {

$ratio = $height / $image_size[0];

$width = $image_size[1] * $ratio;

} elseif ( ($width) && (!$height) ) {

$ratio = $width / $image_size[0];

$height = $image_size[1] * $ratio;

} elseif ( (!$width) && (!$height) ) {

$width = $image_size[0];

$height = $image_size[1];

}

} elseif (IMAGE_REQUIRED == 'false') {

return false;

}

}

 

Just dont know which part to change?

 

All I need is for the pictures in thumbnails to appear in proportion.

 

Can anyone help please

 

Thanks

Link to comment
Share on other sites

Thank for your response,

 

Just tried setting width of small image to 0 and height 100, but image came out even worse proportion. Repeated with zero deleted and same result. Tried swapping height and image...still no joy. Image resize feature is on.

 

hmmm. a bit lost....

Link to comment
Share on other sites

  • 5 months later...

ChainReactionWeb's advice worked for me.

 

I have my width set and the height empty.

 

I also have "Constrain Proportions" and "Calculate Image Size" set to true. However, as I haven't dug through the code yet I'm not completely clear on the difference between them.

 

Good luck.

Link to comment
Share on other sites

Here's the trick...

 

osc will scale the imagesif you enter a width but not ifg you enter the hieght. Thius is due to the fact that the website design should be bigger than the width of the broswer. so the scaling always pays attention to the width.

 

If you are using the Chain Reaction Edition or any multple image mod, you may want to remove the widt and hieght spec all together. This would be only if you have real thumbnails and alternate medium images.

Best Regards,

 

Salvatore Iozzia

 

Loaded Commerce - Oscommerce - All Loaded Up.

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...