![]() |
Codeigniter Crop - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Libraries & Helpers (https://forum.codeigniter.com/forumdisplay.php?fid=22) +--- Thread: Codeigniter Crop (/showthread.php?tid=51635) Pages:
1
2
|
Codeigniter Crop - El Forum - 05-11-2012 [eluser]alexaaaaaaaaaa[/eluser] Hi all i have this code but it's not working like i want and i know there's something easy to find and fix here's my code Code: $x = '9'; Codeigniter Crop - El Forum - 05-11-2012 [eluser]InsiteFX[/eluser] For an image to look correct you need to keep the image aspct ratio! 512x512 256x256 128x128 64x64 32x32 16x16 8x8 4x4 2x2 Code: height = 183 / 2; If you change just one axis your image will never look correct! Codeigniter Crop - El Forum - 05-11-2012 [eluser]alexaaaaaaaaaa[/eluser] [quote author="InsiteFX" date="1336750744"]For an image to look correct you need to keep the image aspct ratio! 512x512 256x256 128x128 64x64 32x32 16x16 8x8 4x4 2x2 Code: height = 183 / 2; If you change just one axis your image will never look correct! [/quote] ok so why we split the height and width on 2 ? i need to crop to a specific size i have the x and y coordonates and based on that i need to crop. If you want i can give you the exact site from where i took the ideea http://fbcover.3fusion.in/ Codeigniter Crop - El Forum - 05-11-2012 [eluser]InsiteFX[/eluser] You only need to divide by 2 4 6 8 etc to maintain the image aspect ratio. You can do it anyway you want really but you need to do both height and width. Codeigniter Crop - El Forum - 05-11-2012 [eluser]Mat-Moo[/eluser] Couple of things, #1 Don't quote your numbers, they are integers so treat them as such. #2 Your height is less than 0? 183-229? don't make sense? #3 Check out my image moo library might make a bit more sense and easier to ue Codeigniter Crop - El Forum - 05-11-2012 [eluser]CroNiX[/eluser] [quote author="Mat-Moo" date="1336762675"]Couple of things, #1 Don't quote your numbers, they are integers so treat them as such. #2 Your height is less than 0? 183-229? don't make sense? #3 Check out my image moo library might make a bit more sense and easier to ue[/quote] it's 183 - (-229), which is a positive number (412). Not sure why he's writing it that way though. Codeigniter Crop - El Forum - 05-11-2012 [eluser]Mat-Moo[/eluser] Good spot, my bad, as you say still daft ![]() Codeigniter Crop - El Forum - 05-12-2012 [eluser]alexaaaaaaaaaa[/eluser] Maybe i didn't explain myself well I have this image ok like 1025x 400 that i upload after i upload i can move it around and then i have the x and y coords to crop, it doesn't have to be square crop it must be 697x183 and crop the image... So first we resize the pic to 697x183 and then we crop where x = 9 and y = -255 now i use this code Code: $x = '9'; http://www.picz.ro/show-image.php?id=505b0c65943f922ea6c296aa2bc1bdb1 Codeigniter Crop - El Forum - 05-12-2012 [eluser]Mat-Moo[/eluser] If your only cropping, why are you calling resize? Did you look at image_moo? 3 lines of code, but it auto crops it to the center for you, so might not be any good... $this->image_moo ->load('DSC01707.JPG') ->resize_crop(697,183) ->save('thumb_ddd.jpg'); Codeigniter Crop - El Forum - 05-12-2012 [eluser]alexaaaaaaaaaa[/eluser] but after cropping i need to resize it right? I took a look after your code and i'll let you know . |