⚠ In case you've missed it, we have migrated to our new website, with a brand new forum. For more details about the migration you can read our blog post for website migration. This is an archived forum. ⚠

  •     

profile picture

callback_after_upload + imgAreaSelect



Гэрэлт-Од Гоцбаяр
  • profile picture
  • Member

Posted 28 February 2013 - 19:52 PM

How can I implement imgAreaSelect Plugin? User step is:

 

1. User upload image.

2. Some dialog with uploaded image will show up. Or without dialog, uploaded image will somehow appear.

3. User will use imgAreaSelect and choose how to crop.

4. Cropped image will stored into database.

 

Current code is (But it uses other library, I need imgAreaSelect):

 

public function news() {

        $this->grocery_crud->set_table('news');
        $this->grocery_crud->set_field_upload('image', 'assets/uploads/images');
        $this->grocery_crud->callback_after_upload(array($this, 'after_upload_pic'));
        $output = $this->grocery_crud->render();

        $this->_example_output($output);
    }

public function after_upload_pic($uploader_response, $field_info, $files_to_upload) {
        
        $this->load->library('md_image'); 
        
        $source_width = "";        //another question. How can I pass source width here?
        $source_height = "";       // how can i pass source height here?

        $file_uploaded = $field_info->upload_path . '/' . $uploader_response[0]->name;

        $this->md_image->crop_to_ratio($file_uploaded, $source_width, $source_height, '620px', '250px', 'assets/uploads/images/thumbs/');

    }

 

I'm following http://ellislab.com/forums/viewthread/121152/ this tutorial.

imgAreaSelect jQuery is here: http://odyniec.net/projects/imgareaselect/

If you don't get my idea, almost same question here: http://ellislab.com/forums/viewthread/195177/