Jump to content
  • Checkout
  • Login
  • Get in touch

osCommerce

The e-commerce.

Image resize by orientation


CandlelightWeb

Recommended Posts

I am trying to come up with a way to resize images depending upon the orientation.

 

The reason is the site sells art. Some is square-ish some is landscaped and some is portrait. The images are being uploaded by the artists who create the art so "manually resize" is not a workable answer.

 

I am trying to do a resize based on something like this:

 

if (height > width)

d = width/height x 640

height = 640 and width = d

if (height < width)

d = height/width x 640

width = 640 and height = d

if (height = width)

width = 480 and height = 480

 

and the other dimmension should be calculated by proportional calculation. This way the large image would be 640x480, 480x640 or 480x480 normally but if their image was something stupid like 1200 height and 400 width it would resize proportionally to a set height of 640 with a variable width and yet if they had 1200 width and 400 height it would resize to a max width of 640 and the height would be calculated to match the original aspect ratio.

 

I am hoping somebody here knows of something that will do this, preferably on the upload as I am using the CRIMAGES addon for "watermark" but if not, I would like to have it at least on the popup_image.php file. However if the image gets resized after the watermark is in place, then that is distorted.

 

I know many people are looking for very similar based on the searches I have done on these forums. Help here will help many.

 

Thank you in advance.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...