Zubrag.com
December 10, 2018, 10:55:58 PM *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: Aspect Ratio  (Read 2368 times)
vysakh
Newbie
*
Posts: 1


« on: May 04, 2016, 07:17:42 AM »

If the image size is greater than the mentioned max_x and max_y it will resize to the given size, but its not resizing to the width and height I have given, Its resizing based on aspect ratio please provide a solution for this

Logged
zubrag
Administrator
Hero Member
*****
Posts: 788


WWW
« Reply #1 on: May 10, 2016, 03:11:40 AM »

I didn't try it, but following may be of help.

Find this code in file image.class.php
Code:
    if ($orig_x > $this->max_x or $orig_y > $this->max_y) {
 
      // resize
      $per_x = $orig_x / $this->max_x;
      $per_y = $orig_y / $this->max_y;
      if ($per_y > $per_x) {
        $this->max_x = $orig_x / $per_y;
      }
      else {
        $this->max_y = $orig_y / $per_x;
      }
 
    }

and replace with this code
Code:
    if ($orig_x > $this->max_x or $orig_y > $this->max_y) {
    }

After this change it will ignore aspect ratio for all images bigger than the max you set, and distort resulting image according to your max x/y settings.
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC