Welcome Guest, Not a member yet? Register   Sign In
Why is image cropping so hard?
#1

[eluser]nuwanda[/eluser]
I've been using the CI image lib. No worries resizing, it's just fine.

But cropping? I just can't make it work.

Code:
$config['x_axis'] = 100;
$config['y_axis'] = 100;
$config['width'] = 100;
$config['height'] = 100;

Now, that code should reference a block 100 x 100, starting 100 in from the left (x) and 100 down from the top (y).

Right?

But no, I get an image that varies depending on the source image. One dimension is correct, but the other appears to vary depending on the source.

I'd kill for a simple example of a crop operation.
#2

[eluser]richthegeek[/eluser]
Try just not bothering with the CI image lib...

PHP GD's imagecopyresized/imagecopyresampled is very easy to implement.
#3

[eluser]nuwanda[/eluser]
[quote author="richthegeek" date="1286279654"]Try just not bothering with the CI image lib...

PHP GD's imagecopyresized/imagecopyresampled is very easy to implement.[/quote]

Sure, but it's kinda weird that it doesn't perform as expected.
#4

[eluser]Krzemo[/eluser]
set aspect_ratio setting to false Smile
#5

[eluser]Mat-Moo[/eluser]
Try out my image_moo library, got easy crop built in Smile
#6

[eluser]nuwanda[/eluser]
[quote author="Cshamoh" date="1286294850"]set aspect_ratio setting to false Smile[/quote]

Well, works perfectly now!

The $config['maintain_ratio'] defaults to true, so it must be set.

Thanks!
#7

[eluser]fedeisas[/eluser]
I've always dreamed of building a CI library to use this: http://odyniec.net/projects/imgareaselect/. It's the only real solution for handling dummy users.
#8

[eluser]Buso[/eluser]
[quote author="fedeisas" date="1286363712"]I've always dreamed of building a CI library to use this: http://odyniec.net/projects/imgareaselect/. It's the only real solution for handling dummy users.[/quote]
o.o nice finding
#9

[eluser]nuwanda[/eluser]
[quote author="fedeisas" date="1286363712"]I've always dreamed of building a CI library to use this: http://odyniec.net/projects/imgareaselect/. It's the only real solution for handling dummy users.[/quote]

Yeah, I used the great little Jcrop script for that. Great addition for users.




Theme © iAndrew 2016 - Forum software by © MyBB