Ilya Karnaukhov
Ilya Karnaukhov

Reputation: 3977

WideImage PHP plugin wrong resize height

I'm using this PHP plugin for image manipulation: http://wideimage.sourceforge.net/

This is my code:

WideImage::load('images/image_test.jpg')

-> resize(300, 150)
-> output('jpg');

And this is the result:

enter image description here

If you look at the dimensions of the screenshot, you'll see they do not coincide with what I told the dimensions to be.

What is going on?

Upvotes: 0

Views: 705

Answers (2)

Ilya Karnaukhov
Ilya Karnaukhov

Reputation: 3977

Answer (thanks to Mihai Todor):

WideImage::load('images/image_test.jpg')

-> resize(300, 150, 'fill')
-> output('jpg');

Apparently it needed the fill statement.

Upvotes: 0

Mihai Todor
Mihai Todor

Reputation: 8249

Well, it looks like it tries to maintain the aspect ratio (height / width). You probably don't want to get your images flattened or stretched, but there should be a setting for this. Maybe setting the $fit parameter to "fill" will help: http://wideimage.sourceforge.net/wp-content/current/doc/WideImage/WideImage_Image.html#methodresize

LE: On the other hand, perhaps you should consider cropping, if you want to change the image size, without altering its aspect.

Upvotes: 2

Related Questions