CodeIgniter Forums

Full Version: Upload/thumbnail
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

El Forum

[eluser]felixk[/eluser]
Hey!

I've coded a image upload function and thumbnail creator. And it works well when I'm running it from my local server, but I've now moved it to another server, which causes the problem.

This is parts from my code!
Code:
// This part works!
        $config['upload_path'] = './uploads/';
        $config['allowed_types'] = 'gif|jpg|jpeg|png';
        $this->load->library('upload', $config);

// Here comes the problem
        $root = "/Fredag/uploads/";
        //Array med alla uppladdningsinformation från "steg 1".
        $upload_data = $this->upload->data();
                
        // ------ STEG 2 ----- //
        $config['image_library'] = 'gd2';
        $config['source_image'] = $_SERVER['DOCUMENT_ROOT'].$root.$upload_data['orig_name'];
        $config['create_thumb'] = TRUE;
        $config['thumb_marker'] = ''; //ändelse innan filformatändelsen. (satt till noll)
        $config['new_image'] = $_SERVER['DOCUMENT_ROOT'].$root.'images/';

Quote:$_SERVER['DOCUMENT_ROOT'] = E:/www/fabrikenfredag.se/www
And the destination folder is E:www/fabrikenfredag.se/www/Fredag/uploads (/images/thumbs)

To sum up, the image is uploaded, but not resized. So it must be a problem to find the source image.

Thankful for help!

El Forum

[eluser]felixk[/eluser]
Anyone? :S

El Forum

[eluser]BrianDHall[/eluser]
Check out the PHP realpath function - your path to file declaration is a bit of a mess to figure out, so there is probably the error there. Try a simple hard-coded string for now to narrow it down.

Also check the is_file() function in PHP - use it on your file to explicitly let you know if the file path is wrong.