Welcome Guest, Not a member yet? Register   Sign In
Image upload and resize issues
#1

[eluser]Angel Web Design[/eluser]
Hi guys.
Having a bit of an issue with the CI image resize stuff.

I upload an image using a form:
Code:
$new_file_name = $_SESSION['id']."-".time().".jpg";
    $base_path = $this->config->item('base_path');
    /**
     * Upload the file
     */
    $config['upload_path'] = $base_path.'web/images/teams/gallery/large/';
    $config['file_name'] = $new_file_name;
    $config['allowed_types'] = 'gif|jpg|png';
    $config['max_size']    = '1000';
    $config['max_width']  = '2500';
    $config['max_height']  = '2500';
    $this->load->library('upload', $config);

Then, if its successful, (which it is currently), resize it to something useful:
Code:
$data = array('upload_data' => $this->upload->data());
            
    //Resize the large image
    $config['image_library'] = 'gd2';
    $config['source_image'] = $data['upload_data']['full_path'];
    $config['maintain_ratio'] = TRUE;
    $config['width'] = 600;
    $config['height'] = 400;
    $this->load->library('image_lib', $config);
    $this->image_lib->resize();
    $this->image_lib->clear();

Now this is fine 90% of the time. If I upload a photo thats for example 1536x2048 pixels, it uploads correctly but on the resize() it dies completely and shows no errors. I can't show any error messages, and after that line even an echo() fails.

Is there something really simple that I am missing here? oh and its not a permissions issue as all the image folders are currently 757 (and the first image wouldn't work in the first place Tongue)

Cheers in advance!
J

//Image info
#2

[eluser]Georgi Budinov[/eluser]
Hi
did you checked the appache error log or the php error log ?
Also I imagine the code for the upload and the code for the resize are one after another so perhaps you will want to reinit the $config var e.g. $config = array();




Theme © iAndrew 2016 - Forum software by © MyBB