Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Image resizing by percentage


Guest

Recommended Posts

Posted

Hey All,

 

I have the following line of code

 

' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], 160, 200) . '

 

The 160 and 200 are the representations for the image height and width ... how do i go about changing it so that its 50% of the original size?

 

Any help would be grrrrand

 

Cheers

Posted

Cheers for that, but i need it to be a percentage of the image size without knowing what the dimensions are ... so the 160 and 200 are not known, if that makes sense

Posted
Cheers for that, but i need it to be a percentage of the image size without knowing what the dimensions are ... so the 160 and 200 are not known, if that makes sense

 

 

There are tage like SMALL_IMAGE_HEIGHT *0.75 , SMALL_IMAGE_WIDTH*0.75 which are set in your admin image folder, but it seems to me that osc sets an image size on images,setting 50% on each size I think makes it 25% of the original size but, I could be wrong!

 

hope this helps

Rusty

-------------------------------------------

Posted

But that would still make them all the same dimensions .... say you have paintings that are landscape and portrait and you want to show them as they look in real.

 

Setting a percentage off the SMALL_IMAGE_HEIGHT would make them all the same dimensions.

 

I need the ones that re portrit to show as portrait and the landscape as landscape

Posted
But that would still make them all the same dimensions .... say you have paintings that are landscape and portrait and you want to show them as they look in real.

 

Setting a percentage off the SMALL_IMAGE_HEIGHT would make them all the same dimensions.

 

I need the ones that re portrit to show as portrait and the landscape as landscape

 

Hi

 

Only set one dimension in the admin

 

ie if the max size you want for width would be 200 , then only set that , leave height blank.

or visa versa,,, this make them all be at least 200 in width and prop.

 

cheers

Rusty

-------------------------------------------

Posted

Use this code before the call to the image

list($width,$height)  = getimagesize(DIR_WS_IMAGES . $new_products['products_image']);
$width *= 1.5;
$height *= 1.5;

Then change the original code to

' . tep_image(DIR_WS_IMAGES . $new_products['products_image'], $new_products['products_name'], $width, $height) . '

That should work, although it will probably distort the image since you usually can't enlarge an image and have it look good.

 

Jack

Support Links:

For Hire: Contact me for anything you need help with for your shop: upgrading, hosting, repairs, code written, etc.

All of My Addons

Get the latest versions of my addons

Recommended SEO Addons

Archived

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

×
×
  • Create New...