image_lib->crop() |
[eluser]AdamCMills[/eluser]
This seems to do nothing ... I am running it here: http://myvaluecoupons.com/user_panel/avatar_upload log in user: test pass: test! if you upload an image drag on the large version to create crop marks (should see a preview of how it should look) then click the "crop" button, you'll see it seems to do nothing. This is the code I have running: Code: $config['image_library'] = 'gd2'; if I set a height ... it does something just not very much ... any help on how exactly to get this crop to show up, and correctly would be greatly appreciated.
[eluser]Thorpe Obazee[/eluser]
1. you need to save the file on the server 2. the source image is the file on your server, not the cropped file At least this is what I think. Haven't used the image lib for cropping.
[eluser]AdamCMills[/eluser]
oh whoops, that file isn't going to work without a login ... login in with these credentials then follow those steps ... sorry user: test pass: test! and $this->session->flashdata('file'); is the file on the server you just uploaded.
[eluser]Thorpe Obazee[/eluser]
[quote author="AdamCMills" date="1244533902"]This seems to do nothing ... I am running it here: http://myvaluecoupons.com/user_panel/avatar_upload log in user: test pass: test! if you upload an image drag on the large version to create crop marks (should see a preview of how it should look) then click the "crop" button, you'll see it seems to do nothing. This is the code I have running: Code: $config['image_library'] = 'gd2'; if I set a height ... it does something just not very much ... any help on how exactly to get this crop to show up, and correctly would be greatly appreciated.[/quote] Try using Code: $this->load->library('image_lib'); Code: $this->load->library('image_lib', $config);
[eluser]AdamCMills[/eluser]
Same results it would seem. Does nothing to the image.
[eluser]Thorpe Obazee[/eluser]
Can you verify that the flashdata return a value?
[eluser]AdamCMills[/eluser]
Verified, using the same variable to redisplay the image "on success". I can accomplish the resize functionality just fine, just the crop code seems to do nothing. I'm wondering if maybe it was a typo in the documentation? It does seem to be missing something ... the reason I say this is... It gets a X axis, it gets a Y axis, but it doesn't get a height and width to base the other two points for a crop off of. I just don't under stand how the code would know unless it assumes you are cropping a specific size. And it seems this is the case ... inside the image_process_gd function in the Image_lib.php libarary file ... line 448: line 453: Code: // If the target width/height match the source, AND if the new file name is not equal to the old file name So the if statement on line 472 never gets execture because you didn't set a height and width. RESOLVED: Despite documentation had to set height and width and the maintain ratio to false ... my workign code looks like this: Code: function crop(){
[eluser]Unknown[/eluser]
oh dude, thanks so much. i think ci authors should see it and update their docs on the subject.
[eluser]thesf[/eluser]
[quote author="bargainph" date="1244536183"] Try using Code: $this->load->library('image_lib'); Code: $this->load->library('image_lib', $config); Its also worth noting that even with a width and height set it wont work unless you use the above tip. Very annoying! Though it might work if its your first use of the image library. I was resizing and then cropping and had used Code: $this->image_lib->clear(); EDIT: Now I think about it maybe it was because the image library had already been loaded once so loading it again wasn't actually doing anything and therefore not initializing the config variables? |
Welcome Guest, Not a member yet? Register Sign In |