Welcome Guest, Not a member yet? Register   Sign In
how to crop image in codeigniter using image manipulation class?
#1

[eluser]Laith99[/eluser]
Hello

i'm using codeigniter to build a project and right now i need to create a thumb depending on user choice. like he will give me X1,Y1,X2,Y2,X3,Y3,X4,Y4 i want to crop the image depending on that 4 points. i checked the image manipulation class. the crop function seems to be very strange. any help please ?

something like this

P1 = (100,100)
P2 = (100,200)
P3 = (200,100)
P4 = (200,200)
#2

[eluser]Krzemo[/eluser]
It is a bit unclear at the beginining, but I guess becouse its just too simple to use Wink
Code:
$config['image_library'] = 'gd2';
$config['source_image'] = $source_image_path + $soure_image_filename;
$config['maintain_ratio'] = FALSE; //most likely youre gonna need that one too
$config['x_axis'] = $x1; //making top left corner
$config['y_axis'] = $y1; //making top left corner          
$config['width'] = $width; //or in your case $x2 - $x1
$config['height'] = $height; //or in your case $y2 - $y1
$config['new_image'] = $new_image_path . $new_image_filename;
$this->image_lib->crop()
Cheers
#3

[eluser]Mat-Moo[/eluser]
http://ellislab.com/forums/viewthread/161469/
You can use my image_moo library as well which makes it easy
$this->image_moo
->load('input.jpg')
->crop(x1,y1,x2,y2)
->save('output.jpg');
#4

[eluser]Laith99[/eluser]
Hello guys

Thanks a lot ... that's helped me so much ... thanks guys




Theme © iAndrew 2016 - Forum software by © MyBB