Yii Framework Forum: Saimagedisplayer - Retain Proportions? - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Saimagedisplayer - Retain Proportions? Saimagedisplayer - retain proportions? Rate Topic: -----

#1 User is offline   rarara 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 1
  • Joined: 21-May 13

Posted 21 May 2013 - 05:19 PM

Hi all,

I've just installed the extension image-displayer (SAimagedisplayer). It works fine, but I want the option to retain the proportions of the image when it's resized. At the moment it is distorting the image by making it fit the size I specify exactly, when I would prefer to be able to specify that it should retain proportions and use those sizes as a max, OR let me specify that I would like it to crop the image so it fills that area. I've used a similar extension in Wordpress that does what I want, so I'm sure Yii has something even better!

Does this image-display extension do that, or is there a more configurable image resizer around?

Thanks for your help.
0

#2 User is offline   darkheir 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 62
  • Joined: 25-July 11

Posted 22 May 2013 - 03:20 AM

Hi,

SAImageDisplayer extension is using the image extension to resize images:

$image->resize($this->_width, $this->_height);


As you can see in the documentation about the resize method from the image extension:

Quote

resize() is used to resize an image. This method is chainable. By default, the aspect ratio will be maintained automatically.


As we do not specify that the ratio doesn't need to be maintained, the resizing in SAImageDisplayer will keep the ratio.

If you need it I could add the option to choose the ratio between:
- Don't keep the ratio
- Resize original image to Height of x pixels, using height to maintain aspect ratio.
- Resize original image to Width of x pixels, using width to maintain aspect ratio.
- Resize original image using automatic aspect ratio calculation

Source: Image Documentation
My blog (in french) => http://blog.devsa.org
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users