Image crop issue |
[eluser]morph london[/eluser]
I have the following code in one of my controllers: function image() { $folder = "assets/images/content/".$this->uri->segment(3)."/".$this->uri->segment(4)."/"; if(!file_exists($folder)) mkdir($folder, 0777); move_uploaded_file($_FILES['Filedata']['tmp_name'], $folder."main.jpg"); if(file_exists($folder."main.jpg")) { $this->load->library('); chmod($folder."main.jpg", 0777); // RESIZE $config['] = 'GD2'; $config['source_image'] = $folder."main.jpg"; $config['maintain_ratio'] = FALSE; $config['width'] = 490; $config['height'] = 234; $this->image_lib->clear(); $this->image_lib->initialize($config); $this->image_lib->resize(); // THUMB $config['] = 'GD2'; $config['source_image'] = $folder."main.jpg"; $config['new_image'] = $folder."thumb.jpg"; $config['maintain_ratio'] = TRUE; $config['height'] = 118; $config['width'] = 247; $this->image_lib->clear(); $this->image_lib->initialize($config); $this->image_lib->resize(); chmod($folder."thumb.jpg", 0777); //CROP THUMB $config['] = 'GD2'; $config['source_image'] = $folder."thumb.jpg"; $config['x_axis'] = '109'; $config['y_axis'] = '118'; $this->image_lib->clear(); $this->image_lib->initialize($config); $this->image_lib->crop(); } } Now I am using this page to upload files from flash. So I point flash to www.mysite.com/uploader/image. Everything works fine the image is uploaded it is then resized and then a thumb is created. The only thing I can not get working is the crop part at the end I want the thumb to be cropped to 109px wide and 118px high, but this is not happening. I am pretty sure my code is as it should be. Thanks
[eluser]tonanbarbarian[/eluser]
the first thing I noticed, and it might not be it, with all the other config sections when you are specifying sizes you are using the numbers as integers in the crop config though you have quotes around the values making them string so change it to this Code: //CROP THUMB somethings it is the weirdest things...
[eluser]kenjis[/eluser]
Hi, How about adding $config[’height’] $config[’width’] in crop method? |
Welcome Guest, Not a member yet? Register Sign In |